Convert setuid/setgid users to xsetuid/xsetgid.
diff --git a/networking/traceroute.c b/networking/traceroute.c
index 79f3957..c2084fc 100644
--- a/networking/traceroute.c
+++ b/networking/traceroute.c
@@ -941,7 +941,6 @@
#endif
u_short off = 0;
struct IFADDRLIST *al;
- int uid = getuid();
char *device = NULL;
int max_ttl = 30;
char *max_ttl_str = NULL;
@@ -1010,8 +1009,7 @@
* set the ip source address of the outbound
* probe (e.g., on a multi-homed host).
*/
- if (uid)
- bb_error_msg_and_die("-s %s: Permission denied", source);
+ if (getuid()) bb_error_msg_and_die("-s %s: Permission denied", source);
}
if(waittime_str)
waittime = str2val(waittime_str, "wait time", 2, 24 * 60 * 60);
@@ -1160,8 +1158,8 @@
sizeof(on));
/* Revert to non-privileged user after opening sockets */
- setgid(getgid());
- setuid(uid);
+ xsetgid(getgid());
+ xsetuid(getuid());
outip = (struct ip *)xcalloc(1, (unsigned)packlen);