From: Todd C. Miller Date: Tue, 28 Sep 2004 18:36:29 +0000 (+0000) Subject: Do signal setup before calling edit_sudoers(). X-Git-Tag: SUDO_1_7_0~927 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=34269049bd1fbe8d85626d615cb39da00176b812;p=sudo Do signal setup before calling edit_sudoers(). Don't shadow the "quiet" global. --- diff --git a/visudo.c b/visudo.c index 80bd85d2f..f4c2c9844 100644 --- 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) {