]> granicus.if.org Git - sudo/commitdiff
Add explicit cast from mode_t -> u_int in printf to silence warnings on Solaris
authorTodd C. Miller <Todd.Miller@courtesan.com>
Sun, 24 Apr 2005 23:24:58 +0000 (23:24 +0000)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Sun, 24 Apr 2005 23:24:58 +0000 (23:24 +0000)
check.c
sudo.c

diff --git a/check.c b/check.c
index a117d74d228bfe4343884e5ffe9ee34dc92f368b..04d60cd539d1593182514cd85e6ee52462be9324 100644 (file)
--- 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 48a76c9e8efec69c4c6ee93ffcb1041a6d7e9be7..6b9fa36539664e487be9a1f8fa9c02e438dad4a0 100644 (file)
--- 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);