ftpd, libls: Compiler warnings.

This commit is contained in:
Mats Erik Andersson
2012-09-11 19:25:38 +02:00
parent 64d135fa07
commit a69f322c04
8 changed files with 42 additions and 16 deletions

View File

@@ -1,3 +1,21 @@
2012-09-11 Mats Erik Andersson <gnu@gisladisker.se>
* 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 <unused-parameter.h>.
(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 <unused-parameter.h>.
(fts_set): Add _GL_UNUSED_PARAMETER.
* libls/ls.c (display): Cast MAXSIZE as off_t.
2012-09-10 Mats Erik Andersson <gnu@gisladisker.se>
* ping/ping.c (ping_finish): Replace format string "%ld"

View File

@@ -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)
)
)
{

View File

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

View File

@@ -23,6 +23,7 @@
#include <string.h>
#include <stdlib.h>
#include <syslog.h>
#include <unused-parameter.h>
#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;

View File

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

View File

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

View File

@@ -55,6 +55,7 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <unused-parameter.h>
#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)

View File

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