]> sjero.net Git - wget/commitdiff
[svn] Don't ftruncate standard output.
authorabbotti <devnull@localhost>
Tue, 14 May 2002 12:23:51 +0000 (05:23 -0700)
committerabbotti <devnull@localhost>
Tue, 14 May 2002 12:23:51 +0000 (05:23 -0700)
Submitted by Bill Richardson  <bill@riverstonenet.com>.
Final version of patch published in
<9vv1eus668tn7v3vn95e7l2lcjbbph8bi2@farscape.privy.mev.co.uk>.

src/ChangeLog
src/ftp.c
src/http.c

index 8e16700e4ecbccc9ff9b277876163085f742fbc5..95009b85ee9de0c7779c4f3dc77753ea1bbfcf97 100644 (file)
@@ -1,3 +1,9 @@
+2002-05-14  Bill Richardson  <bill@riverstonenet.com>
+
+       * ftp.c (getftp): Don't ftruncate stdout.
+
+       * http.c (gethttp): Don't ftruncate stdout.
+
 2002-05-09  Ian Abbott  <abbotti@mev.co.uk>
 
        * cmpt.c (strptime_internal): Synched with glibc-2.1.3.
index ebddf3a06fbfaaf9d8890fbd459452b2ea209bcc..c63ef827c4917a7c7f7defcd0f38ec0193840e9d 100644 (file)
--- 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.  */
index b10960ac916ee832ea53eba7e018adc70c59b78d..9fb0f8e5867de98d95e5a133e9fea59cdfaaf805 100644 (file)
@@ -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.  */