1
0
mirror of https://github.com/moparisthebest/wget synced 2024-07-03 16:38:41 -04:00

[svn] Fix -O timestamp bug.

From <sxs7l57u6o6.fsf@florida.arsdigita.de>.
This commit is contained in:
hniksic 2000-12-10 16:47:44 -08:00
parent 62b876401e
commit d5cd691b12
5 changed files with 35 additions and 4 deletions

View File

@ -1,3 +1,8 @@
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.

View File

@ -1370,7 +1370,17 @@ Already have correct symlink %s -> %s\n\n"),
&& dlthis
&& file_exists_p (u->local))
{
const char *fl = opt.output_document ? opt.output_document : u->local;
/* #### 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)

View File

@ -1533,7 +1533,17 @@ The sizes do not match (local %ld) -- retrieving.\n"), local_size);
((hstat.contlen == -1) ||
(hstat.len >= hstat.contlen && !opt.kill_longer)))))
{
const char *fl = opt.output_document ? opt.output_document : u->local;
/* #### 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. */

View File

@ -726,12 +726,15 @@ Can't timestamp and not clobber old files at the same time.\n"));
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;
}
}

View File

@ -73,6 +73,9 @@ struct options
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. */