summaryrefslogtreecommitdiffstats
path: root/usr.bin/fetch
diff options
context:
space:
mode:
authordes <des@FreeBSD.org>2000-11-30 10:08:22 +0000
committerdes <des@FreeBSD.org>2000-11-30 10:08:22 +0000
commit517ed0bad5cb36c5f8a9f8ab74429174d1fbdca7 (patch)
treee35da5444c47d2c4e721b6d281942469d81e0b4b /usr.bin/fetch
parentd71de754f0f6c9cadf9aaa5261f0d60236236168 (diff)
downloadFreeBSD-src-517ed0bad5cb36c5f8a9f8ab74429174d1fbdca7.zip
FreeBSD-src-517ed0bad5cb36c5f8a9f8ab74429174d1fbdca7.tar.gz
If the transfer timed out, but we don't know how large the file is supposed
to be, assume it was truncated.
Diffstat (limited to 'usr.bin/fetch')
-rw-r--r--usr.bin/fetch/fetch.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/usr.bin/fetch/fetch.c b/usr.bin/fetch/fetch.c
index 7754240..c24d288 100644
--- a/usr.bin/fetch/fetch.c
+++ b/usr.bin/fetch/fetch.c
@@ -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;
OpenPOWER on IntegriCloud