Cast the return value of fcntl() to void when setting FD_CLOEXEC.
Coverity CID 104063, 104064, 104069, 104070, 104071, 104072, 104073, 104074
This commit is contained in:
@@ -330,7 +330,7 @@ open_io_fd(char *pathbuf, size_t len, struct io_log_file *iol, bool docompress)
|
||||
if (iol->enabled) {
|
||||
fd = open(pathbuf, O_CREAT|O_TRUNC|O_WRONLY, S_IRUSR|S_IWUSR);
|
||||
if (fd != -1) {
|
||||
fcntl(fd, F_SETFD, FD_CLOEXEC);
|
||||
(void)fcntl(fd, F_SETFD, FD_CLOEXEC);
|
||||
#ifdef HAVE_ZLIB_H
|
||||
if (docompress)
|
||||
iol->fd.g = gzdopen(fd, "w");
|
||||
|
@@ -684,7 +684,7 @@ digest_matches(const char *file, const struct sudo_digest *sd, int *fd)
|
||||
* on exec flag on the fd for fexecve(2).
|
||||
*/
|
||||
if (!is_script)
|
||||
fcntl(*fd, F_SETFD, FD_CLOEXEC);
|
||||
(void)fcntl(*fd, F_SETFD, FD_CLOEXEC);
|
||||
#endif /* HAVE_FEXECVE */
|
||||
fclose(fp);
|
||||
debug_return_bool(true);
|
||||
|
@@ -86,7 +86,7 @@ setpwent(void)
|
||||
if (pwf == NULL) {
|
||||
pwf = fopen(pwfile, "r");
|
||||
if (pwf != NULL)
|
||||
fcntl(fileno(pwf), F_SETFD, FD_CLOEXEC);
|
||||
(void)fcntl(fileno(pwf), F_SETFD, FD_CLOEXEC);
|
||||
} else {
|
||||
rewind(pwf);
|
||||
}
|
||||
@@ -163,7 +163,7 @@ getpwnam(const char *name)
|
||||
if (pwf == NULL) {
|
||||
if ((pwf = fopen(pwfile, "r")) == NULL)
|
||||
return NULL;
|
||||
fcntl(fileno(pwf), F_SETFD, FD_CLOEXEC);
|
||||
(void)fcntl(fileno(pwf), F_SETFD, FD_CLOEXEC);
|
||||
} else {
|
||||
rewind(pwf);
|
||||
}
|
||||
@@ -186,7 +186,7 @@ getpwuid(uid_t uid)
|
||||
if (pwf == NULL) {
|
||||
if ((pwf = fopen(pwfile, "r")) == NULL)
|
||||
return NULL;
|
||||
fcntl(fileno(pwf), F_SETFD, FD_CLOEXEC);
|
||||
(void)fcntl(fileno(pwf), F_SETFD, FD_CLOEXEC);
|
||||
} else {
|
||||
rewind(pwf);
|
||||
}
|
||||
@@ -215,7 +215,7 @@ setgrent(void)
|
||||
if (grf == NULL) {
|
||||
grf = fopen(grfile, "r");
|
||||
if (grf != NULL)
|
||||
fcntl(fileno(grf), F_SETFD, FD_CLOEXEC);
|
||||
(void)fcntl(fileno(grf), F_SETFD, FD_CLOEXEC);
|
||||
} else {
|
||||
rewind(grf);
|
||||
}
|
||||
@@ -289,7 +289,7 @@ getgrnam(const char *name)
|
||||
if (grf == NULL) {
|
||||
if ((grf = fopen(grfile, "r")) == NULL)
|
||||
return NULL;
|
||||
fcntl(fileno(grf), F_SETFD, FD_CLOEXEC);
|
||||
(void)fcntl(fileno(grf), F_SETFD, FD_CLOEXEC);
|
||||
} else {
|
||||
rewind(grf);
|
||||
}
|
||||
@@ -312,7 +312,7 @@ getgrgid(gid_t gid)
|
||||
if (grf == NULL) {
|
||||
if ((grf = fopen(grfile, "r")) == NULL)
|
||||
return NULL;
|
||||
fcntl(fileno(grf), F_SETFD, FD_CLOEXEC);
|
||||
(void)fcntl(fileno(grf), F_SETFD, FD_CLOEXEC);
|
||||
} else {
|
||||
rewind(grf);
|
||||
}
|
||||
|
@@ -131,7 +131,7 @@ fork_cmnd(struct command_details *details, int sv[2])
|
||||
close(sv[0]);
|
||||
close(signal_pipe[0]);
|
||||
close(signal_pipe[1]);
|
||||
fcntl(sv[1], F_SETFD, FD_CLOEXEC);
|
||||
(void)fcntl(sv[1], F_SETFD, FD_CLOEXEC);
|
||||
exec_cmnd(details, &cstat, sv[1]);
|
||||
send(sv[1], &cstat, sizeof(cstat), 0);
|
||||
sudo_debug_exit_int(__func__, __FILE__, __LINE__, sudo_debug_subsys, 1);
|
||||
|
@@ -843,7 +843,7 @@ fork_pty(struct command_details *details, int sv[], sigset_t *omask)
|
||||
close(sv[0]);
|
||||
close(signal_pipe[0]);
|
||||
close(signal_pipe[1]);
|
||||
fcntl(sv[1], F_SETFD, FD_CLOEXEC);
|
||||
(void)fcntl(sv[1], F_SETFD, FD_CLOEXEC);
|
||||
sigprocmask(SIG_SETMASK, omask, NULL);
|
||||
/* Close the other end of the stdin/stdout/stderr pipes and exec. */
|
||||
if (io_pipe[STDIN_FILENO][1])
|
||||
@@ -1380,7 +1380,7 @@ exec_monitor(struct command_details *details, int backchannel)
|
||||
close(signal_pipe[0]);
|
||||
close(signal_pipe[1]);
|
||||
close(errpipe[0]);
|
||||
fcntl(errpipe[1], F_SETFD, FD_CLOEXEC);
|
||||
(void)fcntl(errpipe[1], F_SETFD, FD_CLOEXEC);
|
||||
restore_signals();
|
||||
|
||||
/* setup tty and exec command */
|
||||
|
@@ -669,7 +669,7 @@ command_info_to_details(char * const info[], struct command_details *details)
|
||||
add_preserved_fd(&details->preserved_fds, details->execfd);
|
||||
#else
|
||||
/* Plugin thinks we support fexecve() but we don't. */
|
||||
fcntl(details->execfd, F_SETFD, FD_CLOEXEC);
|
||||
(void)fcntl(details->execfd, F_SETFD, FD_CLOEXEC);
|
||||
details->execfd = -1;
|
||||
#endif
|
||||
break;
|
||||
|
Reference in New Issue
Block a user