]> granicus.if.org Git - sudo/commitdiff
Quiet a few -Wunused-result compiler warnings.
authorTodd C. Miller <Todd.Miller@courtesan.com>
Wed, 1 May 2013 15:02:09 +0000 (11:02 -0400)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Wed, 1 May 2013 15:02:09 +0000 (11:02 -0400)
common/sudo_debug.c
plugins/sudoers/iolog.c
plugins/sudoers/set_perms.c
src/sudo.c
src/tgetpass.c

index 10251cf24db5a2f5630234cde7a7e7ee1831f15a..c46bf36349b1c0d9adcb5ce29148753ca4fa7de3 100644 (file)
@@ -146,7 +146,7 @@ int sudo_debug_init(const char *debugfile, const char *settings)
            }
            if (sudo_debug_fd == -1)
                return 0;
-           fchown(sudo_debug_fd, (uid_t)-1, 0);
+           ignore_result(fchown(sudo_debug_fd, (uid_t)-1, 0));
        }
        (void)fcntl(sudo_debug_fd, F_SETFD, FD_CLOEXEC);
        sudo_debug_mode = SUDO_DEBUG_MODE_FILE;
index 7a99b4afbdee702466a4487ae9043a6e56e47301..ce5c86e4d35d68a12b9051f378c736d2bdb0bfd6 100644 (file)
@@ -139,7 +139,7 @@ io_mkdirs(char *path, mode_t mode, bool is_temp)
        if (stat(path, &sb) != 0) {
            if (mkdir(path, mode) != 0)
                log_fatal(USE_ERRNO, N_("unable to mkdir %s"), path);
-           (void) chown(path, (uid_t)-1, parent_gid);
+           ignore_result(chown(path, (uid_t)-1, parent_gid));
        } else if (!S_ISDIR(sb.st_mode)) {
            log_fatal(0, N_("%s exists but is not a directory (0%o)"),
                path, (unsigned int) sb.st_mode);
@@ -153,11 +153,11 @@ io_mkdirs(char *path, mode_t mode, bool is_temp)
     if (is_temp) {
        if (mkdtemp(path) == NULL)
            log_fatal(USE_ERRNO, N_("unable to mkdir %s"), path);
-       (void) chown(path, (uid_t)-1, parent_gid);
+       ignore_result(chown(path, (uid_t)-1, parent_gid));
     } else {
        if (mkdir(path, mode) != 0 && errno != EEXIST)
            log_fatal(USE_ERRNO, N_("unable to mkdir %s"), path);
-       (void) chown(path, (uid_t)-1, parent_gid);
+       ignore_result(chown(path, (uid_t)-1, parent_gid));
     }
     debug_return;
 }
index 278392a672613db0eeab7a9f0cd921bfcb44b4f5..a887a512455182a0cb0591910742c980e74c498d 100644 (file)
@@ -1085,7 +1085,7 @@ restore_perms(void)
     if (OID(euid) == ROOT_UID) {
        /* setuid() may not set the saved ID unless the euid is ROOT_UID */
        if (ID(euid) != ROOT_UID)
-           (void)setreuid(-1, ROOT_UID);
+           ignore_result(setreuid(-1, ROOT_UID));
        if (setuid(ROOT_UID)) {
            warning("setuid() [%d, %d] -> %d)", (int)state->ruid,
                (int)state->euid, ROOT_UID);
index 5a849efd3b4ebd207823fe1bd750b2fe098c313e..0de32d4c181ed7856b106bbe7bede326d3f1c7b4 100644 (file)
@@ -276,7 +276,8 @@ main(int argc, char *argv[], char *envp[])
            if (ISSET(sudo_mode, MODE_BACKGROUND))
                SET(command_details.flags, CD_BACKGROUND);
            /* Become full root (not just setuid) so user cannot kill us. */
-           (void) setuid(ROOT_UID);
+           if (setuid(ROOT_UID) == -1)
+               warning("setuid(%d)", ROOT_UID);
            /* Restore coredumpsize resource limit before running. */
 #ifdef RLIMIT_CORE
            if (sudo_conf_disable_coredump())
index d8d77e1fab489f5cddd2ca2ad797b43b32f06dfe..31194b96317fcbaa1e6c123221649eca0ea958f0 100644 (file)
@@ -225,7 +225,8 @@ sudo_askpass(const char *askpass, const char *prompt)
            warning("dup2");
            _exit(255);
        }
-       (void) setuid(ROOT_UID);
+       if (setuid(ROOT_UID) == -1)
+           warning("setuid(%d)", ROOT_UID);
        if (setgid(user_details.gid)) {
            warning(_("unable to set gid to %u"), (unsigned int)user_details.gid);
            _exit(255);