From 043d305fb14592c63bc048c0cc6e3776453b259f Mon Sep 17 00:00:00 2001 From: abbotti Date: Tue, 14 May 2002 05:23:51 -0700 Subject: [PATCH] [svn] Don't ftruncate standard output. Submitted by Bill Richardson . Final version of patch published in <9vv1eus668tn7v3vn95e7l2lcjbbph8bi2@farscape.privy.mev.co.uk>. --- src/ChangeLog | 6 ++++++ src/ftp.c | 2 +- src/http.c | 8 ++++++-- 3 files changed, 13 insertions(+), 3 deletions(-) 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. */ -- 2.39.2