struct toy_context toys;
union global_union this;
-char toybuf[4096];
+char toybuf[4096], libbuf[4096];
struct toy_list *toy_find(char *name)
{
uid_t uid = getuid(), euid = geteuid();
if (!(which->flags & TOYFLAG_STAYROOT)) {
- if (uid != euid) xsetuid(euid=uid);
+ if (uid != euid)
+ if (!setuid(euid=uid)) perror_exit("setuid"); // drop root
} else if (CFG_TOYBOX_DEBUG && uid && which != toy_list)
error_msg("Not installed suid root");
toys.which = toy_list;
if (toys.argv[1]) {
+ toys.optc = 0;
toy_exec(toys.argv+1);
if (toys.argv[1][0] == '-') goto list;
{
if (CFG_TOYBOX_I18N) setlocale(LC_ALL, "");
+ toys.toycount = ARRAY_LEN(toy_list);
+
if (CFG_TOYBOX) {
// Trim path off of command name
*argv = basename(*argv);