aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2014-05-24 13:50:19 -0500
committerRob Landley <rob@landley.net>2014-05-24 13:50:19 -0500
commit3bc5d3d880627b1a9c38ed4b92ff894c7752f124 (patch)
treee094969007ac1a031b6cfa5008caf0de2150fc6c
parent7dfee8efa743c7dffc3803109a143a4d6333556f (diff)
downloadtoybox-3bc5d3d880627b1a9c38ed4b92ff894c7752f124.tar.gz
The "not root" test happens before looking for --help, so "./sulogin --help" doesn't show it. Instead make the "not root" failure case always show help text.
-rw-r--r--main.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/main.c b/main.c
index 38f6d1ad..f0969dfb 100644
--- 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