bug-wget
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug-wget] [Patch] fix bug #40426, wget hangs with -r and -O -


From: Miquel Llobet
Subject: [Bug-wget] [Patch] fix bug #40426, wget hangs with -r and -O -
Date: Fri, 13 Mar 2015 04:15:11 +0100

When wget is called with -r or -p it will look for resource tags in the
output file, and since -O- redirects to stdout, the program hangs, waiting
for input. The same happens with pipes or FIFO files.

My proposed solution is to disallow calling wget with '-p' or '-r' and
output redirection to either stdout or a FIFO file.

--- src/main.c.origin 2015-03-13 03:59:39.000000000 +0100
+++ src/main.c 2015-03-13 04:10:59.000000000 +0100
@@ -42,6 +42,7 @@
 #include <assert.h>
 #include <errno.h>
 #include <time.h>
+#include <sys/stat.h>

 #include "exits.h"
 #include "utils.h"
@@ -1335,6 +1336,18 @@
                          opt.output_document);
               exit (WGET_EXIT_GENERIC_ERROR);
            }
+      if (opt.recursive || opt.page_requisites)
+      {
+        struct stat status;
+        stat (opt.output_document, &status);
+        if (HYPHENP (opt.output_document) || status.st_mode & S_IFIFO)
+          {
+            fprintf (stderr, _("Can't do \
+recursive download with output redirected to stdout, pipe or FIFO
file\n"));
+            print_usage (1);
+            exit (WGET_EXIT_GENERIC_ERROR);
+          }
+      }
     }

   if (opt.warc_filename != 0)


Miquel Llobet


reply via email to

[Prev in Thread] Current Thread [Next in Thread]