diff options
Diffstat (limited to 'src/ftp-basic.c')
-rw-r--r-- | src/ftp-basic.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/src/ftp-basic.c b/src/ftp-basic.c index 4a112c9..bc129f6 100644 --- a/src/ftp-basic.c +++ b/src/ftp-basic.c @@ -57,7 +57,7 @@ as that of the covered work. */ uerr_t ftp_response (int fd, char **ret_line) { - while (1) + for (;;) { char *p; char *line = fd_read_line (fd); @@ -65,12 +65,9 @@ ftp_response (int fd, char **ret_line) return FTPRERR; /* Strip trailing CRLF before printing the line, so that - quotting doesn't include bogus \012 and \015. */ - p = strchr (line, '\0'); - if (p > line && p[-1] == '\n') - *--p = '\0'; - if (p > line && p[-1] == '\r') - *--p = '\0'; + quoting doesn't include bogus \012 and \015. */ + if ((p = strpbrk(line , "\r\n"))) + *p = 0; if (opt.server_response) logprintf (LOG_NOTQUIET, "%s\n", |