changeset 704:e45ab88c477d

Init global context to toybox multiplexer early so error_exit() doesn't segfault trying to print current command name, and change TOYBOX_DEBUG+TOYBOX_SUID complaint about not having the suid bit set to warning rather than exit..
author Rob Landley <rob@landley.net>
date Sun, 18 Nov 2012 18:52:19 -0600
parents 8eb26e828756
children 3e81cd0bad4b
files main.c
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/main.c	Sat Nov 17 22:06:00 2012 -0600
+++ b/main.c	Sun Nov 18 18:52:19 2012 -0600
@@ -71,7 +71,7 @@
 
     if (!(which->flags & TOYFLAG_STAYROOT)) {
       if (uid != euid) xsetuid(euid=uid);
-    } else if (CFG_TOYBOX_DEBUG && uid) error_exit("Not installed suid root");
+    } else if (CFG_TOYBOX_DEBUG && uid) error_msg("Not installed suid root");
 
     if ((which->flags & TOYFLAG_NEEDROOT) && euid) error_exit("Not root");
   }
@@ -113,10 +113,10 @@
   static char *toy_paths[]={"usr/","bin/","sbin/",0};
   int i, len = 0;
 
+  toys.which = toy_list;
   if (toys.argv[1]) {
     if (toys.argv[1][0]!='-') {
       toy_exec(toys.argv+1);
-      toys.which = toy_list;
       error_exit("Unknown command %s",toys.argv[1]);
     }
   }