If the transfer timed out, but we don't know how large the file is supposed

to be, assume it was truncated.
This commit is contained in:
Dag-Erling Smørgrav 2000-11-30 10:08:22 +00:00
parent 6bbbd64fc4
commit 30204f9830
1 changed files with 10 additions and 1 deletions

View File

@ -388,7 +388,7 @@ fetch(char *URL, char *path)
stat_end(&xs);
/* Set mtime of local file */
/* set mtime of local file */
if (!n_flag && us.mtime && !o_stdout
&& (stat(path, &sb) != -1) && sb.st_mode & S_IFREG) {
struct timeval tv[2];
@ -427,6 +427,15 @@ fetch(char *URL, char *path)
goto failure_keep;
}
/*
* If the transfer timed out and we didn't know how much to
* expect, assume the worst (i.e. we didn't get all of it)
*/
if (sigalrm && us.size == -1) {
warnx("%s may be truncated", path);
goto failure_keep;
}
success:
r = 0;
goto done;