[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Bug-wget] [Patch] fix bug #40426, wget hangs with -r and -O -
From: |
Giuseppe Scrivano |
Subject: |
Re: [Bug-wget] [Patch] fix bug #40426, wget hangs with -r and -O - |
Date: |
Sat, 14 Mar 2015 13:21:59 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux) |
Miquel Llobet <address@hidden> writes:
> 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);
> + }
> + }
> }
Another good fix. Care to slightly modify the commit message? :)
Thanks,
Giuseppe