diff options
author | Patrick Ohly <patrick.ohly@intel.com> | 2016-02-09 16:43:35 +0100 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2016-02-10 22:32:37 -0600 |
commit | 62b53ed9e64e40d2534f1239c4b314d84e79f15f (patch) | |
tree | 7f2fa04b2e905432b7693cf41e075b7638cfcd38 | |
parent | e2d042c8e868a129396f03ec759e2ccdb8304833 (diff) | |
download | toybox-62b53ed9e64e40d2534f1239c4b314d84e79f15f.tar.gz |
main.c: fix non-root usage when installed suid root
When toybox is installed suid root and invoked by a non-root user for
commands which do not require root privileges, it drops the root
privileges during initialization.
However, since commit afba5b8efd the result check of setuid() was
inverted such that it aborted on success, making toybox unusuable for
non-root users.
Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
-rw-r--r-- | main.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -107,7 +107,7 @@ void toy_init(struct toy_list *which, char *argv[]) if (!(which->flags & TOYFLAG_STAYROOT)) { if (uid != euid) { - if (!setuid(uid)) perror_exit("setuid %d->%d", euid, uid); // drop root + if (setuid(uid)) perror_exit("setuid %d->%d", euid, uid); // drop root euid = uid; toys.wasroot++; } |