diff options
author | des <des@FreeBSD.org> | 2000-06-28 15:48:26 +0000 |
---|---|---|
committer | des <des@FreeBSD.org> | 2000-06-28 15:48:26 +0000 |
commit | b112ea1321e952999620553fdcca688a1d21d2c3 (patch) | |
tree | cbb185b44b37b777922c1d072659c57d6a39e7e2 /lib/libfetch/ftp.c | |
parent | 114ecdeaa96bb5c3485fa8cd0264b145caf3c8d7 (diff) | |
download | FreeBSD-src-b112ea1321e952999620553fdcca688a1d21d2c3.zip FreeBSD-src-b112ea1321e952999620553fdcca688a1d21d2c3.tar.gz |
Handle multiline replies properly, instead of kinda-right.
Diffstat (limited to 'lib/libfetch/ftp.c')
-rw-r--r-- | lib/libfetch/ftp.c | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/lib/libfetch/ftp.c b/lib/libfetch/ftp.c index a8a4146..c9aec19 100644 --- a/lib/libfetch/ftp.c +++ b/lib/libfetch/ftp.c @@ -134,15 +134,24 @@ unmappedaddr(struct sockaddr_in6 *sin6) static int _ftp_chkerr(int cd) { - do { - if (_fetch_getln(cd, &last_reply, &lr_size, &lr_length) == -1) { - _fetch_syserr(); - return -1; - } + if (_fetch_getln(cd, &last_reply, &lr_size, &lr_length) == -1) { + _fetch_syserr(); + return -1; + } #ifndef NDEBUG - _fetch_info("got reply '%.*s'", lr_length - 2, last_reply); + _fetch_info("got reply '%.*s'", lr_length - 2, last_reply); #endif - } while (isftpinfo(last_reply)); + if (isftpinfo(last_reply)) { + while (!isftpreply(last_reply)) { + if (_fetch_getln(cd, &last_reply, &lr_size, &lr_length) == -1) { + _fetch_syserr(); + return -1; + } +#ifndef NDEBUG + _fetch_info("got reply '%.*s'", lr_length - 2, last_reply); +#endif + } + } while (lr_length && isspace(last_reply[lr_length-1])) lr_length--; |