From: Todd C. Miller Date: Fri, 24 Sep 2004 17:13:24 +0000 (+0000) Subject: Don't close sudoers_fp, keep it open and set close on exec flag instead. X-Git-Tag: SUDO_1_7_0~960 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0c2be08089e2608c58461fee17009defb26176ae;p=sudo Don't close sudoers_fp, keep it open and set close on exec flag instead. --- diff --git a/parse.c b/parse.c index d7eb8dbdb..54887025e 100644 --- a/parse.c +++ b/parse.c @@ -125,10 +125,6 @@ sudoers_lookup(pwflag) set_perms(PERM_RUNAS); error = yyparse(); - /* Close the sudoers file now that we are done with it. */ - (void) fclose(sudoers_fp); - sudoers_fp = NULL; - if (error || parse_error) { set_perms(PERM_ROOT); return(VALIDATE_ERROR); diff --git a/sudo.c b/sudo.c index daa77d5f8..fd4025c7d 100644 --- a/sudo.c +++ b/sudo.c @@ -915,6 +915,7 @@ check_sudoers() if (sudoers_fp == NULL) 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 */ }