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

@@ -42,12 +42,15 @@ char *kcm_ccache_nextid(pid_t pid, uid_t uid, gid_t gid)
{
unsigned n;
char *name;
int ret;
HEIMDAL_MUTEX_lock(&ccache_mutex);
n = ++ccache_nextid;
HEIMDAL_MUTEX_unlock(&ccache_mutex);
asprintf(&name, "%ld:%u", (long)uid, n);
ret = asprintf(&name, "%ld:%u", (long)uid, n);
if (ret == -1)
return NULL;
return name;
}

View File

@@ -86,22 +86,22 @@ static struct getargs args[] = {
},
{
"launchd", 0, arg_flag, &launchd_flag,
"when in use by launchd"
"when in use by launchd", NULL
},
#ifdef SUPPORT_DETACH
#if DETACH_IS_DEFAULT
{
"detach", 'D', arg_negative_flag, &detach_from_console,
"don't detach from console"
"don't detach from console", NULL
},
#else
{
"detach", 0 , arg_flag, &detach_from_console,
"detach from console"
"detach from console", NULL
},
#endif
#endif
{ "help", 'h', arg_flag, &help_flag },
{ "help", 'h', arg_flag, &help_flag, NULL, NULL },
{
"system-principal", 'k', arg_string, &system_principal,
"system principal name", "principal"
@@ -116,11 +116,11 @@ static struct getargs args[] = {
},
{
"name-constraints", 'n', arg_negative_flag, &name_constraints,
"disable credentials cache name constraints"
"disable credentials cache name constraints", NULL
},
{
"disallow-getting-krbtgt", 0, arg_flag, &disallow_getting_krbtgt,
"disable fetching krbtgt from the cache"
"disable fetching krbtgt from the cache", NULL
},
{
"renewable-life", 'r', arg_string, &renew_life,
@@ -148,7 +148,7 @@ static struct getargs args[] = {
"user", 'u', arg_string, &system_user,
"system cache owner", "user"
},
{ "version", 'v', arg_flag, &version_flag }
{ "version", 'v', arg_flag, &version_flag, NULL, NULL }
};
static int num_args = sizeof(args) / sizeof(args[0]);

View File

@@ -263,7 +263,16 @@ static const krb5_cc_ops krb5_kcmss_ops = {
kcmss_end_get,
kcmss_remove_cred,
kcmss_set_flags,
kcmss_get_version
kcmss_get_version,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
};
krb5_error_code

View File

@@ -102,7 +102,8 @@ main(int argc, char **argv)
#endif
#ifdef SUPPORT_DETACH
if (detach_from_console)
daemon(0, 0);
if (daemon(0, 0) == -1)
err(1, "daemon");
#endif
pidfile(NULL);

View File

@@ -1070,6 +1070,7 @@ kcm_op_get_default_cache(krb5_context context,
krb5_error_code ret;
const char *name = NULL;
char *n = NULL;
int aret;
KCM_LOG_REQUEST(context, client, opcode);
@@ -1083,8 +1084,9 @@ kcm_op_get_default_cache(krb5_context context,
name = n = kcm_ccache_first_name(client);
if (name == NULL) {
asprintf(&n, "%d", (int)client->uid);
name = n;
aret = asprintf(&n, "%d", (int)client->uid);
if (aret != -1)
name = n;
}
if (name == NULL)
return ENOMEM;