Fix compilation in ftp.c

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)
               ~~~~~~~~~^~~~~~~~~~~~~~~~~
```
This commit is contained in:
Agustin Chiappe Berrini 2017-08-22 18:03:32 -04:00
parent 876f9f4a27
commit be5277591f

View File

@ -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);
}