]> granicus.if.org Git - sudo/commitdiff
Do signal setup before calling edit_sudoers().
authorTodd C. Miller <Todd.Miller@courtesan.com>
Tue, 28 Sep 2004 18:36:29 +0000 (18:36 +0000)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Tue, 28 Sep 2004 18:36:29 +0000 (18:36 +0000)
Don't shadow the "quiet" global.

visudo.c

index 80bd85d2fa4ab49c75a870b9583e8d972b49d41a..f4c2c98449074953eb89eb9309ba8f81be923098 100644 (file)
--- a/visudo.c
+++ b/visudo.c
@@ -85,7 +85,7 @@ static char whatnow           __P((void));
 static RETSIGTYPE Exit         __P((int));
 static void setup_signals      __P((void));
 static int run_command         __P((char *, char **));
-static int check_syntax                __P((char *, int));
+static int check_syntax                __P((char *));
 static int edit_sudoers                __P((char *, char *));
 int command_matches            __P((char *, char *));
 int addr_matches               __P((char *));
@@ -186,7 +186,7 @@ main(argc, argv)
     init_defaults();
 
     if (checkonly)
-       exit(check_syntax(sudoers.path, quiet));
+       exit(check_syntax(sudoers.path));
 
     /*
      * Check VISUAL and EDITOR environment variables to see which editor
@@ -280,6 +280,9 @@ main(argc, argv)
        }
     }
 
+    /* Install signal handlers to clean up stmp if we are killed. */
+    setup_signals();
+
     for (sp = sudoerslist.first; sp != NULL; sp = sp->next) {
        /* XXX - ask whether user wants to edit included files */
        edit_sudoers(sp->path, Editor);
@@ -330,9 +333,6 @@ edit_sudoers(sudoers_path, editor)
     if (stmp_fd < 0)
        err(1, "%s", stmp);
 
-    /* Install signal handlers to clean up stmp if we are killed. */
-    setup_signals();
-
     /* Copy sudoers_path -> stmp and reset the mtime */
     if (sudoers_size) {
        while ((n = read(sudoers_fd, buf, sizeof(buf))) > 0)
@@ -694,9 +694,8 @@ run_command(path, argv)
 }
 
 static int
-check_syntax(sudoers_path, quiet)
+check_syntax(sudoers_path)
     char *sudoers_path;
-    int quiet;
 {
 
     if ((yyin = fopen(sudoers_path, "r")) == NULL) {