Commit Diff


commit - e442657b19c30b5e241e665c2045e1dbc01382e8
commit + 61379117dee1f6aa36603745f79e8a22d7f4d05a
blob - 9ba61d37637b0bb62d90fcd2821475b4bcd990ab
blob + 746039c12f247f72374cc49c9792c96bcbe0ed52
--- main.c
+++ main.c
@@ -162,8 +162,19 @@ main(int argc, char *argv[])
 		/*
 		 * We start out in privileged mode.
 		 * We are already running as root as per -e option handling.
+		 * The privexec flag also affects the behaviour of commands
+		 * such as 'disable' and 'quit'. 'disable' will pass control
+		 * back to the parent process which runs in non-privileged
+		 * mode. "quit' does the same with a special exit code to let
+		 * the parent know that it should exit immediately.
 		 */
 		priv = 1;
+	} else if (getuid() == 0) {
+		/*
+		 * Root users always start out in privileged mode.
+		 * They can use 'disable' if they want to exit priv mode.
+		 */
+		priv = 1;
 	}
 
 	top = setjmp(toplevel) == 0;