summaryrefslogtreecommitdiff
path: root/src/ftp-basic.c
diff options
context:
space:
mode:
authorDongHun Kwak <dh0128.kwak@samsung.com>2021-03-05 10:08:22 +0900
committerDongHun Kwak <dh0128.kwak@samsung.com>2021-03-05 10:08:22 +0900
commitdfd19f19c019e044f97e46081a6960614c0cf3f9 (patch)
tree51235119408ad6039f4a12286aba64e25176254b /src/ftp-basic.c
parentbe7885cb38b145fc4361200b3351fc2c79e35f3c (diff)
downloadwget-dfd19f19c019e044f97e46081a6960614c0cf3f9.tar.gz
wget-dfd19f19c019e044f97e46081a6960614c0cf3f9.tar.bz2
wget-dfd19f19c019e044f97e46081a6960614c0cf3f9.zip
Imported Upstream version 1.19.5upstream/1.19.5
Diffstat (limited to 'src/ftp-basic.c')
-rw-r--r--src/ftp-basic.c11
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",