2
0
mirror of https://github.com/sudo-project/sudo.git synced 2025-08-22 18:08:23 +00:00

Use FD_CLOEXEC instead of just 1

This commit is contained in:
Todd C. Miller 2024-08-02 19:48:41 -06:00
parent f6064b04c3
commit 1381a69f59

View File

@ -1317,7 +1317,7 @@ open_sudoers(const char *path, char **outfile, bool doedit, bool *keepopen)
} else { } else {
/* Rewind fp and set close on exec flag. */ /* Rewind fp and set close on exec flag. */
rewind(fp); rewind(fp);
(void)fcntl(fileno(fp), F_SETFD, 1); (void)fcntl(fileno(fp), F_SETFD, FD_CLOEXEC);
if (outfile != NULL) { if (outfile != NULL) {
*outfile = sudo_rcstr_dup(fname); *outfile = sudo_rcstr_dup(fname);
if (*outfile == NULL) { if (*outfile == NULL) {