diff options
author | Rob Landley <rob@landley.net> | 2014-05-24 13:50:19 -0500 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2014-05-24 13:50:19 -0500 |
commit | 3bc5d3d880627b1a9c38ed4b92ff894c7752f124 (patch) | |
tree | e094969007ac1a031b6cfa5008caf0de2150fc6c | |
parent | 7dfee8efa743c7dffc3803109a143a4d6333556f (diff) | |
download | toybox-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.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -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 |