From be5277591fe2a142ea3120ddbc16746ea846bc05 Mon Sep 17 00:00:00 2001 From: Agustin Chiappe Berrini Date: Tue, 22 Aug 2017 18:03:32 -0400 Subject: [PATCH] Fix compilation in ftp.c MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When trying to compile the file ftp.c, I get errors related with warnings that were marked to be reported as error. This was the original message: ``` fetch/ftp.c:444:8: error: this statement may fall through [-Werror=implicit-fallthrough=] type = 'D'; ~~~~~^~~~~ fetch/ftp.c:445:2: note: here case 'D': ^~~~ fetch/ftp.c: In function ‘ftp_request’: fetch/ftp.c:342:3: error: missed loop optimization, the loop counter may overflow [-Werror=unsafe-loop-optimizations] for (i = 0; i <= len && i <= end - dst; ++i) ^~~ fetch/ftp.c:342:24: error: missed loop optimization, the loop counter may overflow [-Werror=unsafe-loop-optimizations] for (i = 0; i <= len && i <= end - dst; ++i) ~~~~~~~~~^~~~~~~~~~~~~~~~~ ``` --- lib/fetch/ftp.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/lib/fetch/ftp.c b/lib/fetch/ftp.c index e7ba9039..28296a00 100644 --- a/lib/fetch/ftp.c +++ b/lib/fetch/ftp.c @@ -339,7 +339,7 @@ ftp_cwd(conn_t *conn, const char *path, int subdir) len = strlen(pwd); /* Look for a common prefix between PWD and dir to fetch. */ - for (i = 0; i <= len && i <= end - dst; ++i) + for (i = 0; i < len && i < end - dst; ++i) if (pwd[i] != dst[i]) break; /* Keep going up a dir until we have a matching prefix. */ @@ -440,10 +440,6 @@ ftp_mode_type(conn_t *conn, int mode, int type) type = 'A'; case 'A': break; - case 'd': - type = 'D'; - case 'D': - /* can't handle yet */ default: return (FTP_PROTOCOL_ERROR); }