Hi,
This diff fixes some -Wsign-compare compiler warnings in ftpd(8) by
using the right types for 'i' and 'len'. One warning is left, but I
don't see that it's fixable without suppressing the warning by a cast of
len to size_t. And casting might be controversial in this case?!
/usr/src/libexec/ftpd/ftpd.c:2781:11: warning: comparison of integers of
different signs: 'int' and
'unsigned long' [-Wsign-compare]
if (len >= sizeof(buf) || len == -1) {
~~~ ^ ~~~~~~~~~~~
Bye,
Jan
Index: ftpd.c
===================================================================
RCS file: /cvs/src/libexec/ftpd/ftpd.c,v
retrieving revision 1.223
diff -u -p -r1.223 ftpd.c
--- ftpd.c 3 Sep 2016 15:00:48 -0000 1.223
+++ ftpd.c 24 Nov 2018 22:26:02 -0000
@@ -390,10 +390,10 @@ main(int argc, char *argv[])
endpwent();
if (daemon_mode) {
- int *fds, i, fd;
+ int *fds, fd;
struct pollfd *pfds;
struct addrinfo hints, *res, *res0;
- nfds_t n;
+ nfds_t n, i;
/*
* Detach from parent.
@@ -1809,8 +1809,8 @@ statcmd(void)
ispassive++;
goto printaddr;
} else if (usedefault == 0) {
- size_t alen;
- int af, i;
+ size_t alen, i;
+ int af;
su = (union sockunion *)&data_dest;
printaddr:
@@ -2545,7 +2545,8 @@ guniquefd(char *local, char **nam)
{
static char new[PATH_MAX];
struct stat st;
- int count, len, fd;
+ size_t len;
+ int count, fd;
char *cp;
cp = strrchr(local, '/');