From 2f56da4e007f9706f514608b1a0dc62e70c3b85a Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Fri, 15 Dec 2000 14:36:45 +0000 Subject: 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. --- usr.bin/sudo/visudo.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 */ -- cgit v1.2.3