Turn on -Wextra -Wno-sign-compare -Wno-unused-paramter and fix issues.

We turn on a few extra warnings and fix the fallout that occurs
when building with --enable-developer.  Note that we get different
warnings on different machines and so this will be a work in
progress.  So far, we have built on NetBSD/amd64 5.99.64 (which
uses gcc 4.5.3) and Ubuntu 10.04.3 LTS (which uses gcc 4.4.3).

Notably, we fixed

	1.  a lot of missing structure initialisers,

	2.  unchecked return values for functions that glibc
	    marks as __attribute__((warn-unused-result)),

	3.  made minor modifications to slc and asn1_compile
	    which can generate code which generates warnings,
	    and

	4.  a few stragglers here and there.

We turned off the extended warnings for many programs in appl/ as
they are nearing the end of their useful lifetime, e.g.  rsh, rcp,
popper, ftp and telnet.

Interestingly, glibc's strncmp() macro needed to be worked around
whereas the function calls did not.

We have not yet tried this on 32 bit platforms, so there will be
a few more warnings when we do.
This commit is contained in:
Roland C. Dowdeswell
2012-02-20 19:45:41 +00:00
parent 8ce8cb509a
commit cc47c8fa7b
147 changed files with 1083 additions and 665 deletions

View File

@@ -212,25 +212,32 @@ static int version_flag;
static const char *good_chars = "+-=_,.";
struct getargs args[] = {
{ NULL, 'a', arg_string, &auth_string, "required authentication" },
{ NULL, 'i', arg_flag, &interactive_flag, "don't assume stdin is a socket" },
{ NULL, 'p', arg_string, &port_string, "what port to listen to" },
{ NULL, 'g', arg_string, &guest_umask_string, "umask for guest logins" },
{ NULL, 'a', arg_string, &auth_string, "required authentication", NULL },
{ NULL, 'i', arg_flag, &interactive_flag, "don't assume stdin is a socket",
NULL },
{ NULL, 'p', arg_string, &port_string, "what port to listen to", NULL },
{ NULL, 'g', arg_string, &guest_umask_string, "umask for guest logins",
NULL },
{ NULL, 'l', arg_counter, &logging, "log more stuff", "" },
{ NULL, 't', arg_integer, &ftpd_timeout, "initial timeout" },
{ NULL, 'T', arg_integer, &maxtimeout, "max timeout" },
{ NULL, 'u', arg_string, &umask_string, "umask for user logins" },
{ NULL, 'U', arg_negative_flag, &restricted_data_ports, "don't use high data ports" },
{ NULL, 'd', arg_flag, &debug, "enable debugging" },
{ NULL, 'v', arg_flag, &debug, "enable debugging" },
{ "builtin-ls", 'B', arg_flag, &use_builtin_ls, "use built-in ls to list files" },
{ "good-chars", 0, arg_string, &good_chars, "allowed anonymous upload filename chars" },
{ "insecure-oob", 'I', arg_negative_flag, &allow_insecure_oob, "don't allow insecure OOB ABOR/STAT" },
{ NULL, 't', arg_integer, &ftpd_timeout, "initial timeout", NULL },
{ NULL, 'T', arg_integer, &maxtimeout, "max timeout", NULL },
{ NULL, 'u', arg_string, &umask_string, "umask for user logins", NULL },
{ NULL, 'U', arg_negative_flag, &restricted_data_ports,
"don't use high data ports", NULL },
{ NULL, 'd', arg_flag, &debug, "enable debugging", NULL },
{ NULL, 'v', arg_flag, &debug, "enable debugging", NULL },
{ "builtin-ls", 'B', arg_flag, &use_builtin_ls,
"use built-in ls to list files", NULL },
{ "good-chars", 0, arg_string, &good_chars,
"allowed anonymous upload filename chars", NULL },
{ "insecure-oob", 'I', arg_negative_flag, &allow_insecure_oob,
"don't allow insecure OOB ABOR/STAT", NULL },
#ifdef KRB5
{ "gss-bindings", 0, arg_flag, &ftp_do_gss_bindings, "Require GSS-API bindings", NULL},
{ "gss-bindings", 0, arg_flag, &ftp_do_gss_bindings,
"Require GSS-API bindings", NULL},
#endif
{ "version", 0, arg_flag, &version_flag },
{ "help", 'h', arg_flag, &help_flag }
{ "version", 0, arg_flag, &version_flag, NULL, NULL },
{ "help", 'h', arg_flag, &help_flag, NULL, NULL }
};
static int num_args = sizeof(args) / sizeof(args[0]);
@@ -972,7 +979,7 @@ retrieve(const char *cmd, char *name)
{".tar.Z", "/bin/gtar ZcPf - %s", NULL},
{".gz", "/bin/gzip -c -- %s", "/bin/gzip -c -d -- %s"},
{".Z", "/bin/compress -c -- %s", "/bin/uncompress -c -- %s"},
{NULL, NULL}
{NULL, NULL, NULL}
};
struct cmds *p;
for(p = cmds; p->ext; p++){
@@ -1272,7 +1279,7 @@ dataconn(const char *name, off_t size, const char *mode)
close(pdata);
pdata = s;
#if defined(IPTOS_THROUGHPUT)
if (from->sa_family == AF_INET)
if (from_ss.ss_family == AF_INET)
socket_set_tos(s, IPTOS_THROUGHPUT);
#endif
reply(150, "Opening %s mode data connection for '%s'%s.",

View File

@@ -107,7 +107,9 @@ static void
ftpd_logwtmp_wtmp(char *line, char *name, char *host)
{
static int init = 0;
#ifdef WTMP_FILE
static int fd;
#endif
#ifdef WTMPX_FILE
static int fdx;
#endif
@@ -117,6 +119,9 @@ ftpd_logwtmp_wtmp(char *line, char *name, char *host)
#if defined(WTMPX_FILE) || defined(HAVE_UTMPX_H)
struct utmpx utx;
#endif
#if defined(WTMP_FILE) || defined(WTMPX_FILE)
ssize_t ret;
#endif
#ifdef HAVE_UTMPX_H
memset(&utx, 0, sizeof(struct utmpx));
@@ -176,14 +181,18 @@ ftpd_logwtmp_wtmp(char *line, char *name, char *host)
#endif
init = 1;
}
#if defined(WTMP_FILE) || defined(WTMPX_FILE)
if(fd >= 0) {
#ifdef WTMP_FILE
write(fd, &ut, sizeof(struct utmp)); /* XXX */
ret = write(fd, &ut, sizeof(struct utmp)); /* XXX */
#endif
#ifdef WTMPX_FILE
write(fdx, &utx, sizeof(struct utmpx));
ret = write(fdx, &utx, sizeof(struct utmpx));
#endif
if (ret == -1)
syslog(LOG_ERR, "ftpd_logwtmp_wtmp(): write(2) failed: %m");
}
#endif
}
#endif /* !HAVE_ASL_H */