From: Todd C. Miller Date: Sun, 24 Apr 2005 23:24:58 +0000 (+0000) Subject: Add explicit cast from mode_t -> u_int in printf to silence warnings on Solaris X-Git-Tag: SUDO_1_7_0~646 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c7ea24f2cca394bf74b9560ad2f14aab76af9c44;p=sudo Add explicit cast from mode_t -> u_int in printf to silence warnings on Solaris --- diff --git a/check.c b/check.c index a117d74d2..04d60cd53 100644 --- a/check.c +++ b/check.c @@ -367,7 +367,7 @@ timestamp_status(timestampdir, timestampfile, user, make_dirs) if (lstat(dirparent, &sb) == 0) { if (!S_ISDIR(sb.st_mode)) log_error(NO_EXIT, "%s exists but is not a directory (0%o)", - dirparent, sb.st_mode); + dirparent, (unsigned int) sb.st_mode); else if (sb.st_uid != timestamp_uid) log_error(NO_EXIT, "%s owned by uid %lu, should be uid %lu", dirparent, (unsigned long) sb.st_uid, @@ -375,7 +375,7 @@ timestamp_status(timestampdir, timestampfile, user, make_dirs) else if ((sb.st_mode & 0000022)) log_error(NO_EXIT, "%s writable by non-owner (0%o), should be mode 0700", - dirparent, sb.st_mode); + dirparent, (unsigned int) sb.st_mode); else { if ((sb.st_mode & 0000777) != 0700) (void) chmod(dirparent, 0700); @@ -414,7 +414,7 @@ timestamp_status(timestampdir, timestampfile, user, make_dirs) status = TS_MISSING; } else log_error(NO_EXIT, "%s exists but is not a directory (0%o)", - timestampdir, sb.st_mode); + timestampdir, (unsigned int) sb.st_mode); } else if (sb.st_uid != timestamp_uid) log_error(NO_EXIT, "%s owned by uid %lu, should be uid %lu", timestampdir, (unsigned long) sb.st_uid, @@ -422,7 +422,7 @@ timestamp_status(timestampdir, timestampfile, user, make_dirs) else if ((sb.st_mode & 0000022)) log_error(NO_EXIT, "%s writable by non-owner (0%o), should be mode 0700", - timestampdir, sb.st_mode); + timestampdir, (unsigned int) sb.st_mode); else { if ((sb.st_mode & 0000777) != 0700) (void) chmod(timestampdir, 0700); @@ -454,7 +454,7 @@ timestamp_status(timestampdir, timestampfile, user, make_dirs) if (!S_ISREG(sb.st_mode)) { status = TS_ERROR; log_error(NO_EXIT, "%s exists but is not a regular file (0%o)", - timestampfile, sb.st_mode); + timestampfile, (unsigned int) sb.st_mode); } else { /* If bad uid or file mode, complain and kill the bogus file. */ if (sb.st_uid != timestamp_uid) { @@ -466,7 +466,7 @@ timestamp_status(timestampdir, timestampfile, user, make_dirs) } else if ((sb.st_mode & 0000022)) { log_error(NO_EXIT, "%s writable by non-owner (0%o), should be mode 0600", - timestampfile, sb.st_mode); + timestampfile, (unsigned int) sb.st_mode); (void) unlink(timestampfile); } else { /* If not mode 0600, fix it. */ diff --git a/sudo.c b/sudo.c index 48a76c9e8..6b9fa3653 100644 --- a/sudo.c +++ b/sudo.c @@ -964,7 +964,8 @@ open_sudoers(sudoers, keepopen) log_error(0, "%s is zero length", sudoers); else if ((statbuf.st_mode & 07777) != SUDOERS_MODE) log_error(0, "%s is mode 0%o, should be 0%o", sudoers, - (statbuf.st_mode & 07777), SUDOERS_MODE); + (unsigned int) (statbuf.st_mode & 07777), + (unsigned int) SUDOERS_MODE); else if (statbuf.st_uid != SUDOERS_UID) log_error(0, "%s is owned by uid %lu, should be %lu", sudoers, (unsigned long) statbuf.st_uid, (unsigned long) SUDOERS_UID);