From d6f2f2c3965c0ba87d02e09f9d43b17204eeaa98 Mon Sep 17 00:00:00 2001 From: foobar Date: Thu, 10 Aug 2000 21:13:08 +0000 Subject: [PATCH] @- Fixed FTP module to accept multiline server replies (Jani) # This fixed bug #4546. --- ext/ftp/ftp.c | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/ext/ftp/ftp.c b/ext/ftp/ftp.c index 6664fd587b..45b01e799d 100644 --- a/ext/ftp/ftp.c +++ b/ext/ftp/ftp.c @@ -790,26 +790,29 @@ ftp_readline(ftpbuf_t *ftp) int ftp_getresp(ftpbuf_t *ftp) { - char *buf; + char *buf; - if (ftp == NULL) - return 0; + if (ftp == NULL) return 0; buf = ftp->inbuf; ftp->resp = 0; - while (1) { - if (!ftp_readline(ftp)) - return 0; - if (ftp->inbuf[3] == '-') - continue; - else if (ftp->inbuf[3] != ' ') + + if (!ftp_readline(ftp)) { return 0; - break; + } + + /* Break out when the end-tag is found */ + if (isdigit(ftp->inbuf[0]) && + isdigit(ftp->inbuf[1]) && + isdigit(ftp->inbuf[2]) && + ftp->inbuf[3] == ' ') { + break; + } } /* translate the tag */ - if ( !isdigit(ftp->inbuf[0]) || + if (!isdigit(ftp->inbuf[0]) || !isdigit(ftp->inbuf[1]) || !isdigit(ftp->inbuf[2])) { -- 2.40.0