Check the return value of fcntl() when setting FD_CLOEXEC.
This should never fail unless the fd is invalid. Problem reported by Matthias Gerstner of SUSE.
This commit is contained in:
@@ -56,8 +56,10 @@ linux_audit_open(void)
|
||||
au_fd = AUDIT_NOT_CONFIGURED;
|
||||
else
|
||||
sudo_warn("%s", U_("unable to open audit system"));
|
||||
} else {
|
||||
(void)fcntl(au_fd, F_SETFD, FD_CLOEXEC);
|
||||
} else if (fcntl(au_fd, F_SETFD, FD_CLOEXEC) == -1) {
|
||||
sudo_warn("%s", U_("unable to open audit system"));
|
||||
audit_close(au_fd);
|
||||
au_fd = -1;
|
||||
}
|
||||
debug_return_int(au_fd);
|
||||
}
|
||||
|
Reference in New Issue
Block a user