From 3bc5d3d880627b1a9c38ed4b92ff894c7752f124 Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Sat, 24 May 2014 13:50:19 -0500 Subject: 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. --- main.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'main.c') 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 -- cgit v1.2.3