Published in <sxsitkmgokh.fsf@florida.arsdigita.de>.
+2001-04-02 Hrvoje Niksic <hniksic@arsdigita.com>
+
+ * http.c (http_loop): Ditto.
+
+ * ftp.c (ftp_loop_internal): Made the check whether to continue
+ retrieval `-O'-friendly.
+
2001-04-02 Hrvoje Niksic <hniksic@arsdigita.com>
* netrc.c (parse_netrc): Don't trim the line endings explicitly;
/* This will silently fail for streams that don't correspond
to regular files, but that's OK. */
rewind (fp);
+ /* ftruncate is needed because opt.dfp is opened in append
+ mode if opt.always_rest is set. */
+ ftruncate (fileno (fp), 0);
clearerr (fp);
}
}
restval = 0L;
if ((count > 1 || opt.always_rest)
&& !(con->cmd & DO_LIST)
- && file_exists_p (u->local))
- if (stat (u->local, &st) == 0)
+ && file_exists_p (locf))
+ if (stat (locf, &st) == 0 && S_ISREG (st.st_mode))
restval = st.st_size;
/* Get the current time string. */
tms = time_str (NULL);
/* This will silently fail for streams that don't correspond
to regular files, but that's OK. */
rewind (fp);
+ /* ftruncate is needed because opt.dfp is opened in append
+ mode if opt.always_rest is set. */
+ ftruncate (fileno (fp), 0);
clearerr (fp);
}
}
hstat.restval = 0L;
/* Decide whether or not to restart. */
if (((count > 1 && (*dt & ACCEPTRANGES)) || opt.always_rest)
- && file_exists_p (u->local))
- if (stat (u->local, &st) == 0)
+ && file_exists_p (locf))
+ if (stat (locf, &st) == 0 && S_ISREG (st.st_mode))
hstat.restval = st.st_size;
/* Decide whether to send the no-cache directive. */
if (u->proxy && (count > 1 || (opt.proxy_cache == 0)))
else
{
struct stat st;
- opt.dfp = fopen (opt.output_document, "wb");
+ opt.dfp = fopen (opt.output_document, opt.always_rest ? "ab" : "wb");
if (opt.dfp == NULL)
{
perror (opt.output_document);