From a69f322c049b6645330472393021733018de9fd0 Mon Sep 17 00:00:00 2001 From: Mats Erik Andersson Date: Tue, 11 Sep 2012 19:25:38 +0200 Subject: [PATCH] ftpd, libls: Compiler warnings. --- ChangeLog | 18 ++++++++++++++++++ ftpd/ftpcmd.y | 18 +++++++++--------- ftpd/ftpd.c | 8 +++++--- ftpd/pam.c | 5 +++-- ftpd/popen.c | 2 ++ ftpd/server_mode.c | 2 ++ libls/fts.c | 3 ++- libls/ls.c | 2 +- 8 files changed, 42 insertions(+), 16 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5496d5ed..a0184363 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,21 @@ +2012-09-11 Mats Erik Andersson + + * ftpd/ftpcmd.y (cmd): Add parantheses to separate + subordinate && from ||. + * ftpd/ftpd.c (off_to_str): Cast OFF as long. + (options): Fill in missing fields. + (main) [!HAVE_INITSETPROCTITLE]: Trivially use envp. + * ftpd/pam.c: Include . + (pam_pass): Cast passwd as `char *'. + (pam_end_login): Add _GL_UNUSED_PARAMETER. + * ftpd/popen.c (ls_main prototype) [WITH_LIBLS]: + Enclose within conditional WITH_LIBLS. + * ftpd/server_mode.c (server_mode) [HAVE_FORK]: + Trivially use argv. + * libls/fts.c: Include . + (fts_set): Add _GL_UNUSED_PARAMETER. + * libls/ls.c (display): Cast MAXSIZE as off_t. + 2012-09-10 Mats Erik Andersson * ping/ping.c (ping_finish): Replace format string "%ld" diff --git a/ftpd/ftpcmd.y b/ftpd/ftpcmd.y index 1bfe92b5..278cb902 100644 --- a/ftpd/ftpcmd.y +++ b/ftpd/ftpcmd.y @@ -197,19 +197,19 @@ cmd { if ($2) { if ($4 - && (his_addr.ss_family == AF_INET + && ((his_addr.ss_family == AF_INET && memcmp (&((struct sockaddr_in *) &his_addr)->sin_addr, &((struct sockaddr_in *) &data_dest)->sin_addr, sizeof (struct in_addr)) == 0 && ntohs (((struct sockaddr_in *) &data_dest)->sin_port) - > IPPORT_RESERVED + > IPPORT_RESERVED) || - his_addr.ss_family == AF_INET6 + (his_addr.ss_family == AF_INET6 && memcmp (&((struct sockaddr_in6 *) &his_addr)->sin6_addr, &((struct sockaddr_in6 *) &data_dest)->sin6_addr, sizeof (struct in6_addr)) == 0 && ntohs (((struct sockaddr_in6 *) &data_dest)->sin6_port) - > IPPORT_RESERVED + > IPPORT_RESERVED) ) ) { @@ -730,19 +730,19 @@ cmd if ($2) { if ($4 && - ( his_addr.ss_family == AF_INET + ((his_addr.ss_family == AF_INET && memcmp (&((struct sockaddr_in *) &his_addr)->sin_addr, &((struct sockaddr_in *) &data_dest)->sin_addr, sizeof (struct in_addr)) == 0 && ntohs (((struct sockaddr_in *) &data_dest)->sin_port) - > IPPORT_RESERVED - || - his_addr.ss_family == AF_INET6 + > IPPORT_RESERVED) + || + (his_addr.ss_family == AF_INET6 && memcmp (&((struct sockaddr_in6 *) &his_addr)->sin6_addr, &((struct sockaddr_in6 *) &data_dest)->sin6_addr, sizeof (struct in6_addr)) == 0 && ntohs (((struct sockaddr_in6 *) &data_dest)->sin6_port) - > IPPORT_RESERVED + > IPPORT_RESERVED) ) ) { diff --git a/ftpd/ftpd.c b/ftpd/ftpd.c index c73bb7c6..d796fc04 100644 --- a/ftpd/ftpd.c +++ b/ftpd/ftpd.c @@ -191,7 +191,7 @@ off_to_str (off_t off) if (sizeof (off) > sizeof (long)) sprintf (*next_buf, "%lld", (long long int) off); else if (sizeof (off) == sizeof (long)) - sprintf (*next_buf, "%ld", off); + sprintf (*next_buf, "%ld", (long) off); else sprintf (*next_buf, "%d", (int) off); @@ -316,7 +316,7 @@ static struct argp_option options[] = { "", GRID+3 }, #endif - { NULL } + { NULL, 0, NULL, 0, NULL, 0 } }; static error_t @@ -441,7 +441,9 @@ main (int argc, char *argv[], char **envp) #ifdef HAVE_INITSETPROCTITLE /* Save start and extent of argv for setproctitle. */ initsetproctitle (argc, argv, envp); -#endif /* HAVE_INITSETPROCTITLE */ +#else /* !HAVE_INITSETPROCTITLE */ + (void) envp; /* Silence warnings. */ +#endif /* Parse the command line */ iu_argp_init ("ftpd", default_program_authors); diff --git a/ftpd/pam.c b/ftpd/pam.c index 41973cee..6f4fe007 100644 --- a/ftpd/pam.c +++ b/ftpd/pam.c @@ -23,6 +23,7 @@ #include #include #include +#include #include "extern.h" #ifdef HAVE_SECURITY_PAM_APPL_H @@ -255,7 +256,7 @@ pam_pass (const char *passwd, struct credentials *pcred) int error = PAM_AUTH_ERR; if (pamh) { - pcred->pass = passwd; + pcred->pass = (char *) passwd; error = pam_doit (pcred); pcred->pass = NULL; } @@ -263,7 +264,7 @@ pam_pass (const char *passwd, struct credentials *pcred) } void -pam_end_login (struct credentials * pcred) +pam_end_login (struct credentials * pcred _GL_UNUSED_PARAMETER) { int error; diff --git a/ftpd/popen.c b/ftpd/popen.c index 83b9dc09..8aa8a112 100644 --- a/ftpd/popen.c +++ b/ftpd/popen.c @@ -86,7 +86,9 @@ struct file_pid /* A linked list associating ftpd_popen'd FILEs with pids. */ struct file_pid *file_pids = 0; +#ifdef WITH_LIBLS extern int ls_main (int argc, char *argv[]); +#endif FILE * ftpd_popen (char *program, const char *type) diff --git a/ftpd/server_mode.c b/ftpd/server_mode.c index 0a487730..7b7771ee 100644 --- a/ftpd/server_mode.c +++ b/ftpd/server_mode.c @@ -234,6 +234,8 @@ server_mode (const char *pidfile, struct sockaddr *phis_addr, #ifndef HAVE_FORK _exit (execvp (argv[0], argv)); +#else + (void) argv; /* Silence warnings. */ #endif return fd; diff --git a/libls/fts.c b/libls/fts.c index b9736f45..35d0de4d 100644 --- a/libls/fts.c +++ b/libls/fts.c @@ -55,6 +55,7 @@ #include #include #include +#include #include "fts.h" @@ -512,7 +513,7 @@ next:tmp = p; * reasons. */ int -fts_set (FTS *sp, FTSENT *p, int instr) +fts_set (FTS *sp _GL_UNUSED_PARAMETER, FTSENT *p, int instr) { if (instr && instr != FTS_AGAIN && instr != FTS_FOLLOW && instr != FTS_NOINSTR && instr != FTS_SKIP) diff --git a/libls/ls.c b/libls/ls.c index f3318198..481f76fc 100644 --- a/libls/ls.c +++ b/libls/ls.c @@ -494,7 +494,7 @@ display (FTSENT *p, FTSENT *list) maxinode = sp->st_ino; if (sp->st_nlink > maxnlink) maxnlink = sp->st_nlink; - if (sp->st_size > maxsize) + if (sp->st_size > (off_t) maxsize) maxsize = sp->st_size; btotal += sp->st_blocks;