diff options
author | Rob Landley | 2006-07-15 23:00:46 +0000 |
---|---|---|
committer | Rob Landley | 2006-07-15 23:00:46 +0000 |
commit | df822f2606a5c56a8af5785d4e507aff2eeaaace (patch) | |
tree | 087cd0a58a163f3ea7819e59abecbd901227486a /libbb | |
parent | 1870737480b8beaa6c8834b916da7f73f4fb4807 (diff) | |
download | busybox-df822f2606a5c56a8af5785d4e507aff2eeaaace.zip busybox-df822f2606a5c56a8af5785d4e507aff2eeaaace.tar.gz |
We need xsetuid() and xsetgid() because per-user process resource limits can
prevent a process from switching to a user that has too many processes, and
when that happens WE'RE STILL ROOT. See http://lwn.net/Articles/190331/
Diffstat (limited to 'libbb')
-rw-r--r-- | libbb/xfuncs.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/libbb/xfuncs.c b/libbb/xfuncs.c index bcd0751..d843414 100644 --- a/libbb/xfuncs.c +++ b/libbb/xfuncs.c @@ -282,3 +282,15 @@ char *itoa(int n) return local_buf; } #endif + +#ifdef L_setuid +void xsetgid(gid_t gid) +{ + if (setgid(gid)) bb_error_msg_and_die("setgid"); +} + +void xsetuid(uid_t uid) +{ + if (setuid(uid)) bb_error_msg_and_die("setuid"); +} +#endif |