From <sxs7l57u6o6.fsf@florida.arsdigita.de>.
+2000-12-11 Hrvoje Niksic <hniksic@arsdigita.com>
+
+ * http.c (http_loop): Furthermore, touch output_document only if
+ it is known to be an existing regular file.
+
2000-12-11 Hrvoje Niksic <hniksic@arsdigita.com>
* ftp.c (ftp_retrieve_list): Ditto.
&& dlthis
&& file_exists_p (u->local))
{
- const char *fl = opt.output_document ? opt.output_document : u->local;
- touch (fl, f->tstamp);
+ /* #### This code repeats in http.c and ftp.c. Move it to a
+ function! */
+ const char *fl = NULL;
+ if (opt.output_document)
+ {
+ if (opt.od_known_regular)
+ fl = opt.output_document;
+ }
+ else
+ fl = u->local;
+ if (fl)
+ touch (fl, f->tstamp);
}
else if (f->tstamp == -1)
logprintf (LOG_NOTQUIET, _("%s: corrupt time-stamp.\n"), u->local);
((hstat.contlen == -1) ||
(hstat.len >= hstat.contlen && !opt.kill_longer)))))
{
- const char *fl = opt.output_document ? opt.output_document : u->local;
- touch (fl, tmr);
+ /* #### This code repeats in http.c and ftp.c. Move it to a
+ function! */
+ const char *fl = NULL;
+ if (opt.output_document)
+ {
+ if (opt.od_known_regular)
+ fl = opt.output_document;
+ }
+ else
+ fl = u->local;
+ if (fl)
+ touch (fl, tmr);
}
/* End of time-stamping section. */
opt.dfp = stdout;
else
{
+ struct stat st;
opt.dfp = fopen (opt.output_document, "wb");
if (opt.dfp == NULL)
{
perror (opt.output_document);
exit (1);
}
+ if (fstat (fileno (opt.dfp), &st) == 0 && S_ISREG (st.st_mode))
+ opt.od_known_regular = 1;
}
}
FTP. */
char *output_document; /* The output file to which the
documents will be printed. */
+ int od_known_regular; /* whether output_document is a
+ regular file we can manipulate,
+ i.e. not `-' or a device file. */
FILE *dfp; /* The file pointer to the output
document. */