summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2000-12-15 14:36:45 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2000-12-15 14:36:45 +0000
commit2f56da4e007f9706f514608b1a0dc62e70c3b85a (patch)
treee41ab1886fa5dae8898dd17dae3865eef8f4711f
parentb82df945ea8eead73355210cbd6bb3c310dde16d (diff)
If there was a syntax error and the user just wants to exit, unlink
sudoers if it is zero length since visudo probably just created it. From the sudo cvs repo.
-rw-r--r--usr.bin/sudo/visudo.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/usr.bin/sudo/visudo.c b/usr.bin/sudo/visudo.c
index 4117615b137..ba8fa565174 100644
--- a/usr.bin/sudo/visudo.c
+++ b/usr.bin/sudo/visudo.c
@@ -310,7 +310,9 @@ main(argc, argv)
switch (whatnow()) {
case 'Q' : parse_error = FALSE; /* ignore parse error */
break;
- case 'x' : Exit(0);
+ case 'x' : if (sudoers_sb.st_size == 0)
+ unlink(sudoers);
+ Exit(0);
break;
}
yyrestart(yyin); /* reset lexer */