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:
parent
62b876401e
commit
d5cd691b12
@ -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.
|
||||
|
14
src/ftp.c
14
src/ftp.c
@ -1370,8 +1370,18 @@ 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;
|
||||
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);
|
||||
|
14
src/http.c
14
src/http.c
@ -1533,8 +1533,18 @@ 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;
|
||||
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. */
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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. */
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user