Add casts to quiet compiler warnings.

This commit is contained in:
Todd C. Miller
2010-06-01 09:54:03 -04:00
parent be3b7d615a
commit 2ee7524101
3 changed files with 16 additions and 9 deletions

View File

@@ -47,6 +47,7 @@
#endif #endif
#include <compat.h> #include <compat.h>
#include <missing.h>
#include <alloc.h> #include <alloc.h>
#include <error.h> #include <error.h>

View File

@@ -100,7 +100,7 @@ get_boottime(struct timeval *tv)
{ {
struct utmpx *ut, key; struct utmpx *ut, key;
zero_bytes(&key, sizeof(key)); memset(&key, 0, sizeof(key));
key.ut_type = BOOT_TIME; key.ut_type = BOOT_TIME;
if ((ut = getutxid(&key)) != NULL) { if ((ut = getutxid(&key)) != NULL) {
tv->tv_sec = ut->ut_tv.tv_sec; tv->tv_sec = ut->ut_tv.tv_sec;
@@ -118,7 +118,7 @@ get_boottime(struct timeval *tv)
{ {
struct utmp *ut, key; struct utmp *ut, key;
zero_bytes(&key, sizeof(key)); memset(&key, 0, sizeof(key));
key.ut_type = BOOT_TIME; key.ut_type = BOOT_TIME;
if ((ut = getutid(&key)) != NULL) { if ((ut = getutid(&key)) != NULL) {
tv->tv_sec = ut->ut_time; tv->tv_sec = ut->ut_time;

View File

@@ -546,7 +546,7 @@ sudoers_policy_main(int argc, char * const argv[], int pwflag, char *env_add[],
mask |= omask; mask |= omask;
umask(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)) { 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); command_info[info_len++] = fmt_string("command", safe_cmnd);
} }
if (def_stay_setuid) { if (def_stay_setuid) {
easprintf(&command_info[info_len++], "runas_uid=%u", user_uid); easprintf(&command_info[info_len++], "runas_uid=%u",
easprintf(&command_info[info_len++], "runas_gid=%u", user_gid); (unsigned int)user_uid);
easprintf(&command_info[info_len++], "runas_euid=%u", runas_pw->pw_uid); easprintf(&command_info[info_len++], "runas_gid=%u",
easprintf(&command_info[info_len++], "runas_egid=%u", runas_pw->pw_gid); (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 { } else {
easprintf(&command_info[info_len++], "runas_uid=%u", runas_pw->pw_uid); easprintf(&command_info[info_len++], "runas_uid=%u",
easprintf(&command_info[info_len++], "runas_gid=%u", runas_pw->pw_gid); (unsigned int)runas_pw->pw_uid);
easprintf(&command_info[info_len++], "runas_gid=%u",
(unsigned int)runas_pw->pw_gid);
} }
if (def_preserve_groups) { if (def_preserve_groups) {
command_info[info_len++] = "preserve_groups=true"; command_info[info_len++] = "preserve_groups=true";