diff options
author | des <des@FreeBSD.org> | 2000-07-25 14:41:02 +0000 |
---|---|---|
committer | des <des@FreeBSD.org> | 2000-07-25 14:41:02 +0000 |
commit | e534b00520eb5f1e40415e2537be435b7523dedc (patch) | |
tree | 94febc735cf146d49f6846c84f84fa82a3a225bf /lib/libfetch/ftp.c | |
parent | d540fdf263bcdcb13569b9f42a85e8fd85ca8a3c (diff) | |
download | FreeBSD-src-e534b00520eb5f1e40415e2537be435b7523dedc.zip FreeBSD-src-e534b00520eb5f1e40415e2537be435b7523dedc.tar.gz |
If the server reports the size as 0, treat it as unknown. This works around
a bug in some ftp servers (most notably ftp.vmunix.com) which report the
size of a file correctly in ascii mode, but report it as 0 in binary mode.
Reported by: asmodai
Also remove an unneeded initialization.
Diffstat (limited to 'lib/libfetch/ftp.c')
-rw-r--r-- | lib/libfetch/ftp.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/lib/libfetch/ftp.c b/lib/libfetch/ftp.c index 8e38beb..031a243 100644 --- a/lib/libfetch/ftp.c +++ b/lib/libfetch/ftp.c @@ -259,6 +259,8 @@ _ftp_stat(int cd, char *file, struct url_stat *us) _ftp_seterr(FTP_PROTOCOL_ERROR); return -1; } + if (us->size == 0) + us->size = -1; DEBUG(fprintf(stderr, "size: [\033[1m%lld\033[m]\n", us->size)); if ((e = _ftp_cmd(cd, "MDTM %s", s)) != FTP_FILE_STATUS) { @@ -845,9 +847,6 @@ fetchStatFTP(struct url *url, struct url_stat *us, char *flags) if (_ftp_use_http_proxy()) return fetchStatHTTP(url, us, flags); - us->size = -1; - us->atime = us->mtime = 0; - /* connect to server */ if ((cd = _ftp_cached_connect(url, flags)) == NULL) return -1; |