]> sjero.net Git - wget/blobdiff - src/http.c
[svn] Gracefully handle opt.downloaded overflowing.
[wget] / src / http.c
index 59cfc04475014f451c1c17fc4af420d96deabc2d..37b9872451e703fba363ff5cc0bb41d71ab0d723 100644 (file)
@@ -843,8 +843,17 @@ Accept: %s\r\n\
          return FOPENERR;
        }
     }
-  else                      /* opt.dfp */
-    fp = opt.dfp;
+  else                         /* opt.dfp */
+    {
+      fp = opt.dfp;
+      if (!hs->restval)
+       {
+         /* This will silently fail for streams that don't correspond
+            to regular files, but that's OK.  */
+         rewind (fp);
+         clearerr (fp);
+       }
+    }
 
   /* #### This confuses the code that checks for file size.  There
      should be some overhead information.  */
@@ -1214,7 +1223,7 @@ The sizes do not match (local %ld) -- retrieving.\n"), local_size);
                         tms, u->url, hstat.len, hstat.contlen, locf, count);
            }
          ++opt.numurls;
-         opt.downloaded += hstat.len;
+         downloaded_increase (hstat.len);
 
          /* Remember that we downloaded the file for later ".orig" code. */
          if (*dt & ADDED_HTML_EXTENSION)
@@ -1240,7 +1249,7 @@ The sizes do not match (local %ld) -- retrieving.\n"), local_size);
                             tms, u->url, hstat.len, locf, count);
                }
              ++opt.numurls;
-             opt.downloaded += hstat.len;
+             downloaded_increase (hstat.len);
 
              /* Remember that we downloaded the file for later ".orig" code. */
              if (*dt & ADDED_HTML_EXTENSION)
@@ -1269,7 +1278,7 @@ The sizes do not match (local %ld) -- retrieving.\n"), local_size);
                         "%s URL:%s [%ld/%ld] -> \"%s\" [%d]\n",
                         tms, u->url, hstat.len, hstat.contlen, locf, count);
              ++opt.numurls;
-             opt.downloaded += hstat.len;
+             downloaded_increase (hstat.len);
 
              /* Remember that we downloaded the file for later ".orig" code. */
              if (*dt & ADDED_HTML_EXTENSION)