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/
This commit was genuinely broken at the time (not related to our build system): scripts/config/mkconfigs.c (2005-08-01 - 2006-10-05 arasi) uretilen bbconfigopts.h icine .config satirlarini kacissiz, ham newline'larla gömüyordu - gecerli C degildi, busybox'un kendi bb_mkdep araci bile parse edemiyordu (7d219aab7 ile duzeltildi, mkconfigs shell scripte cevrildi)
No binary (build failed)
—
(log yok)
| @@ -185,6 +185,8 @@ extern void utoa_to_buf(unsigned n, char *buf, unsigned buflen); | |
| extern char *utoa(unsigned n); | |
| extern void itoa_to_buf(int n, char *buf, unsigned buflen); | |
| extern char *itoa(int n); | |
| + | extern void xsetgid(gid_t gid); |
| + | extern void xsetuid(uid_t uid); |
| #define BB_GETOPT_ERROR 0x80000000UL | |
| extern const char *bb_opt_complementally; | |
| @@ -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 |