OSDN Git Service

The "not root" test happens before looking for --help, so "./sulogin --help" doesn...
authorRob Landley <rob@landley.net>
Sat, 24 May 2014 18:50:19 +0000 (13:50 -0500)
committerRob Landley <rob@landley.net>
Sat, 24 May 2014 18:50:19 +0000 (13:50 -0500)
main.c

diff --git a/main.c b/main.c
index 38f6d1a..f0969df 100644 (file)
--- a/main.c
+++ b/main.c
@@ -98,7 +98,10 @@ void toy_init(struct toy_list *which, char *argv[])
     } else if (CFG_TOYBOX_DEBUG && uid && which != toy_list)
       error_msg("Not installed suid root");
 
-    if ((which->flags & TOYFLAG_NEEDROOT) && euid) error_exit("Not root");
+    if ((which->flags & TOYFLAG_NEEDROOT) && euid) {
+      toys.exithelp++;
+      error_exit("Not root");
+    }
   }
 
   // Free old toys contents (to be reentrant), but leave rebound if any