2
0
mirror of https://github.com/sudo-project/sudo.git synced 2025-09-01 06:45:10 +00:00

Don't close sudoers_fp, keep it open and set close on exec flag instead.

This commit is contained in:
Todd C. Miller
2004-09-24 17:13:24 +00:00
parent ef874440a5
commit 0c2be08089
2 changed files with 1 additions and 4 deletions

View File

@@ -125,10 +125,6 @@ sudoers_lookup(pwflag)
set_perms(PERM_RUNAS); set_perms(PERM_RUNAS);
error = yyparse(); error = yyparse();
/* Close the sudoers file now that we are done with it. */
(void) fclose(sudoers_fp);
sudoers_fp = NULL;
if (error || parse_error) { if (error || parse_error) {
set_perms(PERM_ROOT); set_perms(PERM_ROOT);
return(VALIDATE_ERROR); return(VALIDATE_ERROR);

1
sudo.c
View File

@@ -915,6 +915,7 @@ check_sudoers()
if (sudoers_fp == NULL) if (sudoers_fp == NULL)
log_error(USE_ERRNO, "can't open %s", _PATH_SUDOERS); log_error(USE_ERRNO, "can't open %s", _PATH_SUDOERS);
} }
(void) fcntl(fileno(sudoers_fp), F_SETFD, 1);
set_perms(PERM_ROOT); /* change back to root */ set_perms(PERM_ROOT); /* change back to root */
} }