]> granicus.if.org Git - sudo/commitdiff
Don't close sudoers_fp, keep it open and set close on exec flag instead.
authorTodd C. Miller <Todd.Miller@courtesan.com>
Fri, 24 Sep 2004 17:13:24 +0000 (17:13 +0000)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Fri, 24 Sep 2004 17:13:24 +0000 (17:13 +0000)
parse.c
sudo.c

diff --git a/parse.c b/parse.c
index d7eb8dbdb0b44a9a36912898c5b9ae9d4c7cd8f1..54887025e9a1a68ae9ae9699c8abb27a3e4afd6e 100644 (file)
--- 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 daa77d5f84614e986125cf7a1ebcd3a00574963b..fd4025c7d2282350f769159e664cee59bdf5bfff 100644 (file)
--- 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 */
 }