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) {
|
if (iol->enabled) {
|
||||||
fd = open(pathbuf, O_CREAT|O_TRUNC|O_WRONLY, S_IRUSR|S_IWUSR);
|
fd = open(pathbuf, O_CREAT|O_TRUNC|O_WRONLY, S_IRUSR|S_IWUSR);
|
||||||
if (fd != -1) {
|
if (fd != -1) {
|
||||||
fcntl(fd, F_SETFD, FD_CLOEXEC);
|
(void)fcntl(fd, F_SETFD, FD_CLOEXEC);
|
||||||
#ifdef HAVE_ZLIB_H
|
#ifdef HAVE_ZLIB_H
|
||||||
if (docompress)
|
if (docompress)
|
||||||
iol->fd.g = gzdopen(fd, "w");
|
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).
|
* on exec flag on the fd for fexecve(2).
|
||||||
*/
|
*/
|
||||||
if (!is_script)
|
if (!is_script)
|
||||||
fcntl(*fd, F_SETFD, FD_CLOEXEC);
|
(void)fcntl(*fd, F_SETFD, FD_CLOEXEC);
|
||||||
#endif /* HAVE_FEXECVE */
|
#endif /* HAVE_FEXECVE */
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
debug_return_bool(true);
|
debug_return_bool(true);
|
||||||
|
@@ -86,7 +86,7 @@ setpwent(void)
|
|||||||
if (pwf == NULL) {
|
if (pwf == NULL) {
|
||||||
pwf = fopen(pwfile, "r");
|
pwf = fopen(pwfile, "r");
|
||||||
if (pwf != NULL)
|
if (pwf != NULL)
|
||||||
fcntl(fileno(pwf), F_SETFD, FD_CLOEXEC);
|
(void)fcntl(fileno(pwf), F_SETFD, FD_CLOEXEC);
|
||||||
} else {
|
} else {
|
||||||
rewind(pwf);
|
rewind(pwf);
|
||||||
}
|
}
|
||||||
@@ -163,7 +163,7 @@ getpwnam(const char *name)
|
|||||||
if (pwf == NULL) {
|
if (pwf == NULL) {
|
||||||
if ((pwf = fopen(pwfile, "r")) == NULL)
|
if ((pwf = fopen(pwfile, "r")) == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
fcntl(fileno(pwf), F_SETFD, FD_CLOEXEC);
|
(void)fcntl(fileno(pwf), F_SETFD, FD_CLOEXEC);
|
||||||
} else {
|
} else {
|
||||||
rewind(pwf);
|
rewind(pwf);
|
||||||
}
|
}
|
||||||
@@ -186,7 +186,7 @@ getpwuid(uid_t uid)
|
|||||||
if (pwf == NULL) {
|
if (pwf == NULL) {
|
||||||
if ((pwf = fopen(pwfile, "r")) == NULL)
|
if ((pwf = fopen(pwfile, "r")) == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
fcntl(fileno(pwf), F_SETFD, FD_CLOEXEC);
|
(void)fcntl(fileno(pwf), F_SETFD, FD_CLOEXEC);
|
||||||
} else {
|
} else {
|
||||||
rewind(pwf);
|
rewind(pwf);
|
||||||
}
|
}
|
||||||
@@ -215,7 +215,7 @@ setgrent(void)
|
|||||||
if (grf == NULL) {
|
if (grf == NULL) {
|
||||||
grf = fopen(grfile, "r");
|
grf = fopen(grfile, "r");
|
||||||
if (grf != NULL)
|
if (grf != NULL)
|
||||||
fcntl(fileno(grf), F_SETFD, FD_CLOEXEC);
|
(void)fcntl(fileno(grf), F_SETFD, FD_CLOEXEC);
|
||||||
} else {
|
} else {
|
||||||
rewind(grf);
|
rewind(grf);
|
||||||
}
|
}
|
||||||
@@ -289,7 +289,7 @@ getgrnam(const char *name)
|
|||||||
if (grf == NULL) {
|
if (grf == NULL) {
|
||||||
if ((grf = fopen(grfile, "r")) == NULL)
|
if ((grf = fopen(grfile, "r")) == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
fcntl(fileno(grf), F_SETFD, FD_CLOEXEC);
|
(void)fcntl(fileno(grf), F_SETFD, FD_CLOEXEC);
|
||||||
} else {
|
} else {
|
||||||
rewind(grf);
|
rewind(grf);
|
||||||
}
|
}
|
||||||
@@ -312,7 +312,7 @@ getgrgid(gid_t gid)
|
|||||||
if (grf == NULL) {
|
if (grf == NULL) {
|
||||||
if ((grf = fopen(grfile, "r")) == NULL)
|
if ((grf = fopen(grfile, "r")) == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
fcntl(fileno(grf), F_SETFD, FD_CLOEXEC);
|
(void)fcntl(fileno(grf), F_SETFD, FD_CLOEXEC);
|
||||||
} else {
|
} else {
|
||||||
rewind(grf);
|
rewind(grf);
|
||||||
}
|
}
|
||||||
|
@@ -131,7 +131,7 @@ fork_cmnd(struct command_details *details, int sv[2])
|
|||||||
close(sv[0]);
|
close(sv[0]);
|
||||||
close(signal_pipe[0]);
|
close(signal_pipe[0]);
|
||||||
close(signal_pipe[1]);
|
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]);
|
exec_cmnd(details, &cstat, sv[1]);
|
||||||
send(sv[1], &cstat, sizeof(cstat), 0);
|
send(sv[1], &cstat, sizeof(cstat), 0);
|
||||||
sudo_debug_exit_int(__func__, __FILE__, __LINE__, sudo_debug_subsys, 1);
|
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(sv[0]);
|
||||||
close(signal_pipe[0]);
|
close(signal_pipe[0]);
|
||||||
close(signal_pipe[1]);
|
close(signal_pipe[1]);
|
||||||
fcntl(sv[1], F_SETFD, FD_CLOEXEC);
|
(void)fcntl(sv[1], F_SETFD, FD_CLOEXEC);
|
||||||
sigprocmask(SIG_SETMASK, omask, NULL);
|
sigprocmask(SIG_SETMASK, omask, NULL);
|
||||||
/* Close the other end of the stdin/stdout/stderr pipes and exec. */
|
/* Close the other end of the stdin/stdout/stderr pipes and exec. */
|
||||||
if (io_pipe[STDIN_FILENO][1])
|
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[0]);
|
||||||
close(signal_pipe[1]);
|
close(signal_pipe[1]);
|
||||||
close(errpipe[0]);
|
close(errpipe[0]);
|
||||||
fcntl(errpipe[1], F_SETFD, FD_CLOEXEC);
|
(void)fcntl(errpipe[1], F_SETFD, FD_CLOEXEC);
|
||||||
restore_signals();
|
restore_signals();
|
||||||
|
|
||||||
/* setup tty and exec command */
|
/* 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);
|
add_preserved_fd(&details->preserved_fds, details->execfd);
|
||||||
#else
|
#else
|
||||||
/* Plugin thinks we support fexecve() but we don't. */
|
/* 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;
|
details->execfd = -1;
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
|
Reference in New Issue
Block a user