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:
@@ -623,24 +623,25 @@ open_stats(krb5_context context)
|
||||
{
|
||||
char *statfile = NULL;
|
||||
const char *fn;
|
||||
FILE *f;
|
||||
int ret;
|
||||
|
||||
if (slave_stats_file)
|
||||
fn = slave_stats_file;
|
||||
else {
|
||||
asprintf(&statfile, "%s/slaves-stats", hdb_db_dir(context));
|
||||
ret = asprintf(&statfile, "%s/slaves-stats", hdb_db_dir(context));
|
||||
if (ret == -1)
|
||||
return NULL;
|
||||
fn = krb5_config_get_string_default(context,
|
||||
NULL,
|
||||
statfile,
|
||||
"kdc",
|
||||
"iprop-stats",
|
||||
NULL);
|
||||
}
|
||||
f = fopen(fn, "w");
|
||||
if (statfile)
|
||||
free(statfile);
|
||||
|
||||
return f;
|
||||
}
|
||||
if (fn == NULL)
|
||||
return NULL;
|
||||
return fopen(fn, "w");
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -776,6 +777,7 @@ main(int argc, char **argv)
|
||||
uint32_t current_version = 0, old_version = 0;
|
||||
krb5_keytab keytab;
|
||||
char **files;
|
||||
int aret;
|
||||
|
||||
(void) krb5_program_setup(&context, argc, argv, args, num_args, NULL);
|
||||
|
||||
@@ -789,8 +791,8 @@ main(int argc, char **argv)
|
||||
setup_signal();
|
||||
|
||||
if (config_file == NULL) {
|
||||
asprintf(&config_file, "%s/kdc.conf", hdb_db_dir(context));
|
||||
if (config_file == NULL)
|
||||
aret = asprintf(&config_file, "%s/kdc.conf", hdb_db_dir(context));
|
||||
if (aret == -1 || config_file == NULL)
|
||||
errx(1, "out of memory");
|
||||
}
|
||||
|
||||
@@ -811,8 +813,13 @@ main(int argc, char **argv)
|
||||
krb5_errx (context, 1, "couldn't parse time: %s", slave_time_missing);
|
||||
|
||||
#ifdef SUPPORT_DETACH
|
||||
if (detach_from_console)
|
||||
daemon(0, 0);
|
||||
if (detach_from_console) {
|
||||
aret = daemon(0, 0);
|
||||
if (aret == -1) {
|
||||
/* not much to do if detaching fails... */
|
||||
krb5_err(context, 1, aret, "failed to daemon(3)ise");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
pidfile (NULL);
|
||||
krb5_openlog (context, "ipropd-master", &log_facility);
|
||||
|
Reference in New Issue
Block a user