Add -Wshadow and deal with the warnings.

This commit is contained in:
Roland C. Dowdeswell
2012-02-21 11:17:55 +00:00
parent cc47c8fa7b
commit e8779d5d4a
39 changed files with 214 additions and 217 deletions

View File

@@ -58,31 +58,31 @@ static struct getargs args[] = {
static int num_args = sizeof(args) / sizeof(args[0]);
static void
usage(int code, struct getargs *args, int num_args)
usage(int code, struct getargs *inargs, int num_inargs)
{
arg_printusage(args, num_args, NULL, "hosts");
arg_printusage(inargs, num_inargs, NULL, "hosts");
exit(code);
}
static int
client_setup(krb5_context *context, int *argc, char **argv)
client_setup(krb5_context *ctx, int *argc, char **argv)
{
int optind = 0;
int optidx = 0;
int port = 0;
int status;
setprogname (argv[0]);
status = krb5_init_context (context);
status = krb5_init_context (ctx);
if (status)
errx(1, "krb5_init_context failed: %d", status);
forwardable = krb5_config_get_bool (*context, NULL,
forwardable = krb5_config_get_bool (*ctx, NULL,
"libdefaults",
"forwardable",
NULL);
if (getarg (args, num_args, *argc, argv, &optind))
if (getarg (args, num_args, *argc, argv, &optidx))
usage(1, args, num_args);
if(help_flag)
@@ -107,11 +107,11 @@ client_setup(krb5_context *context, int *argc, char **argv)
}
if (port == 0)
port = krb5_getportbyname (*context, KF_PORT_NAME, "tcp", KF_PORT_NUM);
port = krb5_getportbyname (*ctx, KF_PORT_NAME, "tcp", KF_PORT_NUM);
if(*argc - optind < 1)
if(*argc - optidx < 1)
usage(1, args, num_args);
*argc = optind;
*argc = optidx;
return port;
}
@@ -122,7 +122,7 @@ client_setup(krb5_context *context, int *argc, char **argv)
*/
static int
proto (int sock, const char *hostname, const char *service,
proto (int sock, const char *hostname, const char *svc,
char *message, size_t len)
{
krb5_auth_context auth_context;
@@ -153,7 +153,7 @@ proto (int sock, const char *hostname, const char *service,
status = krb5_sname_to_principal (context,
hostname,
service,
svc,
KRB5_NT_SRV_HST,
&server);
if (status) {
@@ -281,7 +281,7 @@ proto (int sock, const char *hostname, const char *service,
}
static int
doit (const char *hostname, int port, const char *service,
doit (const char *hostname, int port, const char *svc,
char *message, size_t len)
{
struct addrinfo *ai, *a;
@@ -312,7 +312,7 @@ doit (const char *hostname, int port, const char *service,
continue;
}
freeaddrinfo (ai);
return proto (s, hostname, service, message, len);
return proto (s, hostname, svc, message, len);
}
warnx ("failed to contact %s", hostname);
freeaddrinfo (ai);

View File

@@ -56,19 +56,19 @@ static struct getargs args[] = {
static int num_args = sizeof(args) / sizeof(args[0]);
static void
usage(int code, struct getargs *args, int num_args)
usage(int code, struct getargs *inargs, int num_inargs)
{
arg_printusage(args, num_args, NULL, "");
arg_printusage(inargs, num_inargs, NULL, "");
exit(code);
}
static int
server_setup(krb5_context *context, int argc, char **argv)
server_setup(krb5_context *ctx, int argc, char **argv)
{
int port = 0;
int local_argc;
local_argc = krb5_program_setup(context, argc, argv, args, num_args, usage);
local_argc = krb5_program_setup(ctx, argc, argv, args, num_args, usage);
if(help_flag)
(*usage)(0, args, num_args);
@@ -92,7 +92,7 @@ server_setup(krb5_context *context, int argc, char **argv)
}
if (port == 0)
port = krb5_getportbyname (*context, KF_PORT_NAME, "tcp", KF_PORT_NUM);
port = krb5_getportbyname (*ctx, KF_PORT_NAME, "tcp", KF_PORT_NUM);
if(argv[local_argc] != NULL)
usage(1, args, num_args);
@@ -120,7 +120,7 @@ kfd_match_version(const void *arg, const char *version)
}
static int
proto (int sock, const char *service)
proto (int sock, const char *svc)
{
krb5_auth_context auth_context;
krb5_error_code status;
@@ -151,7 +151,7 @@ proto (int sock, const char *service)
status = krb5_sname_to_principal (context,
hostname,
service,
svc,
KRB5_NT_SRV_HST,
&server);
if (status)
@@ -281,11 +281,11 @@ proto (int sock, const char *service)
}
static int
doit (int port, const char *service)
doit (int port, const char *svc)
{
if (do_inetd)
mini_inetd(port, NULL);
return proto (STDIN_FILENO, service);
return proto (STDIN_FILENO, svc);
}
int