]> sjero.net Git - wget/blobdiff - src/http.c
[svn] Don't ftruncate standard output.
[wget] / src / http.c
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.  */