From 2ee752410153ac519f29aaf817b7657e94637a46 Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Tue, 1 Jun 2010 09:54:03 -0400 Subject: [PATCH] Add casts to quiet compiler warnings. --- common/alloc.c | 1 + plugins/sudoers/boottime.c | 4 ++-- plugins/sudoers/sudoers.c | 20 +++++++++++++------- 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/common/alloc.c b/common/alloc.c index 979021869..e0846d40b 100644 --- a/common/alloc.c +++ b/common/alloc.c @@ -47,6 +47,7 @@ #endif #include +#include #include #include diff --git a/plugins/sudoers/boottime.c b/plugins/sudoers/boottime.c index 7f2f7d614..e740d78d1 100644 --- a/plugins/sudoers/boottime.c +++ b/plugins/sudoers/boottime.c @@ -100,7 +100,7 @@ get_boottime(struct timeval *tv) { struct utmpx *ut, key; - zero_bytes(&key, sizeof(key)); + memset(&key, 0, sizeof(key)); key.ut_type = BOOT_TIME; if ((ut = getutxid(&key)) != NULL) { tv->tv_sec = ut->ut_tv.tv_sec; @@ -118,7 +118,7 @@ get_boottime(struct timeval *tv) { struct utmp *ut, key; - zero_bytes(&key, sizeof(key)); + memset(&key, 0, sizeof(key)); key.ut_type = BOOT_TIME; if ((ut = getutid(&key)) != NULL) { tv->tv_sec = ut->ut_time; diff --git a/plugins/sudoers/sudoers.c b/plugins/sudoers/sudoers.c index d62923a3a..c82fb1e5e 100644 --- a/plugins/sudoers/sudoers.c +++ b/plugins/sudoers/sudoers.c @@ -546,7 +546,7 @@ sudoers_policy_main(int argc, char * const argv[], int pwflag, char *env_add[], mask |= omask; umask(omask); } - easprintf(&command_info[info_len++], "umask=0%o", mask); + easprintf(&command_info[info_len++], "umask=0%o", (unsigned int)mask); } if (ISSET(sudo_mode, MODE_LOGIN_SHELL)) { @@ -593,13 +593,19 @@ sudoers_policy_main(int argc, char * const argv[], int pwflag, char *env_add[], command_info[info_len++] = fmt_string("command", safe_cmnd); } if (def_stay_setuid) { - easprintf(&command_info[info_len++], "runas_uid=%u", user_uid); - easprintf(&command_info[info_len++], "runas_gid=%u", user_gid); - easprintf(&command_info[info_len++], "runas_euid=%u", runas_pw->pw_uid); - easprintf(&command_info[info_len++], "runas_egid=%u", runas_pw->pw_gid); + easprintf(&command_info[info_len++], "runas_uid=%u", + (unsigned int)user_uid); + easprintf(&command_info[info_len++], "runas_gid=%u", + (unsigned int)user_gid); + easprintf(&command_info[info_len++], "runas_euid=%u", + (unsigned int)runas_pw->pw_uid); + easprintf(&command_info[info_len++], "runas_egid=%u", + (unsigned int)runas_pw->pw_gid); } else { - easprintf(&command_info[info_len++], "runas_uid=%u", runas_pw->pw_uid); - easprintf(&command_info[info_len++], "runas_gid=%u", runas_pw->pw_gid); + easprintf(&command_info[info_len++], "runas_uid=%u", + (unsigned int)runas_pw->pw_uid); + easprintf(&command_info[info_len++], "runas_gid=%u", + (unsigned int)runas_pw->pw_gid); } if (def_preserve_groups) { command_info[info_len++] = "preserve_groups=true";