aboutsummaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'main.c')
-rw-r--r--main.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/main.c b/main.c
index 7355f0a2..8fe8e058 100644
--- a/main.c
+++ b/main.c
@@ -92,7 +92,8 @@ void toy_init(struct toy_list *which, char *argv[])
uid_t uid = getuid(), euid = geteuid();
if (!(which->flags & TOYFLAG_STAYROOT)) {
- if (uid != euid) xsetuid(euid=uid); // drop root
+ 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");