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.
This commit is contained in:
Dag-Erling Smørgrav 2000-07-25 14:41:02 +00:00
parent 0d58a2010e
commit 63428824c9

View File

@ -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;