diff --git a/src/ChangeLog b/src/ChangeLog index 8e16700e..95009b85 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2002-05-14 Bill Richardson + + * ftp.c (getftp): Don't ftruncate stdout. + + * http.c (gethttp): Don't ftruncate stdout. + 2002-05-09 Ian Abbott * cmpt.c (strptime_internal): Synched with glibc-2.1.3. diff --git a/src/ftp.c b/src/ftp.c index ebddf3a0..c63ef827 100644 --- a/src/ftp.c +++ b/src/ftp.c @@ -861,7 +861,7 @@ Error in server response, closing control connection.\n")); /* Rewind the output document if the download starts over and if this is the first download. See gethttp() for a longer explanation. */ - if (!restval && global_download_count == 0) + if (!restval && global_download_count == 0 && opt.dfp != stdout) { /* This will silently fail for streams that don't correspond to regular files, but that's OK. */ diff --git a/src/http.c b/src/http.c index b10960ac..9fb0f8e5 100644 --- a/src/http.c +++ b/src/http.c @@ -1508,8 +1508,12 @@ Refusing to truncate existing file `%s'.\n\n"), *hs->local_file); #### A possible solution to this would be to remember the file position in the output document and to seek to that - position, instead of rewinding. */ - if (!hs->restval && global_download_count == 0) + position, instead of rewinding. + + We don't truncate stdout, since that breaks + "wget -O - [...] >> foo". + */ + if (!hs->restval && global_download_count == 0 && opt.dfp != stdout) { /* This will silently fail for streams that don't correspond to regular files, but that's OK. */