minor sign fixes pointed out by gcc -Wsign-compare

This commit is contained in:
Todd C. Miller
2002-11-22 19:11:47 +00:00
parent b152da4cdb
commit fd140ff5da
2 changed files with 18 additions and 17 deletions

View File

@@ -137,7 +137,7 @@ do_syslog(pri, msg)
int pri; int pri;
char *msg; char *msg;
{ {
int count; size_t count;
char *p; char *p;
char *tmp; char *tmp;
char save; char save;
@@ -188,9 +188,10 @@ do_logfile(msg)
char *beg, *oldend, *end; char *beg, *oldend, *end;
FILE *fp; FILE *fp;
mode_t oldmask; mode_t oldmask;
int maxlen = def_ival(I_LOGLINELEN); size_t maxlen;
oldmask = umask(077); oldmask = umask(077);
maxlen = def_ival(I_LOGLINELEN) > 0 ? def_ival(I_LOGLINELEN) : 0;
fp = fopen(def_str(I_LOGFILE), "a"); fp = fopen(def_str(I_LOGFILE), "a");
(void) umask(oldmask); (void) umask(oldmask);
if (fp == NULL) { if (fp == NULL) {

View File

@@ -1000,21 +1000,21 @@ dumpaliases()
void void
list_matches() list_matches()
{ {
int i; size_t count;
char *p; char *p;
struct generic_alias *ga, key; struct generic_alias *ga, key;
(void) printf("User %s may run the following commands on this host:\n", (void) printf("User %s may run the following commands on this host:\n",
user_name); user_name);
for (i = 0; i < cm_list_len; i++) { for (count = 0; count < cm_list_len; count++) {
/* Print the runas list. */ /* Print the runas list. */
(void) fputs(" ", stdout); (void) fputs(" ", stdout);
if (cm_list[i].runas) { if (cm_list[count].runas) {
(void) putchar('('); (void) putchar('(');
p = strtok(cm_list[i].runas, ", "); p = strtok(cm_list[count].runas, ", ");
do { do {
if (p != cm_list[i].runas) if (p != cm_list[count].runas)
(void) fputs(", ", stdout); (void) fputs(", ", stdout);
key.alias = p; key.alias = p;
@@ -1031,32 +1031,32 @@ list_matches()
} }
/* Is a password required? */ /* Is a password required? */
if (cm_list[i].nopasswd == TRUE && def_flag(I_AUTHENTICATE)) if (cm_list[count].nopasswd == TRUE && def_flag(I_AUTHENTICATE))
(void) fputs("NOPASSWD: ", stdout); (void) fputs("NOPASSWD: ", stdout);
else if (cm_list[i].nopasswd == FALSE && !def_flag(I_AUTHENTICATE)) else if (cm_list[count].nopasswd == FALSE && !def_flag(I_AUTHENTICATE))
(void) fputs("PASSWD: ", stdout); (void) fputs("PASSWD: ", stdout);
/* Print the actual command or expanded Cmnd_Alias. */ /* Print the actual command or expanded Cmnd_Alias. */
key.alias = cm_list[i].cmnd; key.alias = cm_list[count].cmnd;
key.type = CMND_ALIAS; key.type = CMND_ALIAS;
if ((ga = (struct generic_alias *) lfind((VOID *) &key, if ((ga = (struct generic_alias *) lfind((VOID *) &key,
(VOID *) &ga_list[0], &ga_list_len, sizeof(key), genaliascmp))) (VOID *) &ga_list[0], &ga_list_len, sizeof(key), genaliascmp)))
(void) puts(ga->entries); (void) puts(ga->entries);
else else
(void) puts(cm_list[i].cmnd); (void) puts(cm_list[count].cmnd);
} }
/* Be nice and free up space now that we are done. */ /* Be nice and free up space now that we are done. */
for (i = 0; i < ga_list_len; i++) { for (count = 0; count < ga_list_len; count++) {
free(ga_list[i].alias); free(ga_list[count].alias);
free(ga_list[i].entries); free(ga_list[count].entries);
} }
free(ga_list); free(ga_list);
ga_list = NULL; ga_list = NULL;
for (i = 0; i < cm_list_len; i++) { for (count = 0; count < cm_list_len; count++) {
free(cm_list[i].runas); free(cm_list[count].runas);
free(cm_list[i].cmnd); free(cm_list[count].cmnd);
} }
free(cm_list); free(cm_list);
cm_list = NULL; cm_list = NULL;