From e534b00520eb5f1e40415e2537be435b7523dedc Mon Sep 17 00:00:00 2001 From: des Date: Tue, 25 Jul 2000 14:41:02 +0000 Subject: 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. --- lib/libfetch/ftp.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'lib/libfetch') 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; -- cgit v1.1