summaryrefslogtreecommitdiffstats
path: root/usr.bin/fetch
diff options
context:
space:
mode:
authordes <des@FreeBSD.org>2000-12-22 18:23:19 +0000
committerdes <des@FreeBSD.org>2000-12-22 18:23:19 +0000
commitd6547b8df5a42e6d9951c814c1d47199e4beb2a7 (patch)
tree4a7bf1d172a1736df22727460a1f8de02582eb6e /usr.bin/fetch
parent68260023b05583fb2a300792050ec2941e89ba4f (diff)
downloadFreeBSD-src-d6547b8df5a42e6d9951c814c1d47199e4beb2a7.zip
FreeBSD-src-d6547b8df5a42e6d9951c814c1d47199e4beb2a7.tar.gz
Warn if the size of the remote file isn't known.
If the -R option was specified, don't truncate the local file even if its mtime is incorrect. PR: bin/23719
Diffstat (limited to 'usr.bin/fetch')
-rw-r--r--usr.bin/fetch/fetch.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/usr.bin/fetch/fetch.c b/usr.bin/fetch/fetch.c
index 024d71e..a0796a7 100644
--- a/usr.bin/fetch/fetch.c
+++ b/usr.bin/fetch/fetch.c
@@ -305,12 +305,15 @@ fetch(char *URL, char *path)
goto success;
}
+ if (us.size == -1)
+ warnx("%s: size of remote file is not known", path);
if (v_level > 1) {
if (sb.st_size != -1)
fprintf(stderr, "local size / mtime: %lld / %ld\n",
sb.st_size, sb.st_mtime);
- fprintf(stderr, "remote size / mtime: %lld / %ld\n",
- us.size, us.mtime);
+ if (us.size != -1)
+ fprintf(stderr, "remote size / mtime: %lld / %ld\n",
+ us.size, us.mtime);
}
/* open output file */
@@ -322,6 +325,12 @@ fetch(char *URL, char *path)
if (!F_flag && us.mtime && sb.st_mtime != us.mtime) {
/* no match! have to refetch */
fclose(f);
+ /* if precious, warn the user and give up */
+ if (R_flag) {
+ warnx("%s: local modification time does not match remote",
+ path);
+ goto failure_keep;
+ }
url->offset = 0;
if ((f = fetchXGet(url, &us, flags)) == NULL) {
warnx("%s: %s", path, fetchLastErrString);
OpenPOWER on IntegriCloud