}
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;
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);
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;
}
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);
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())
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);