summaryrefslogtreecommitdiff
path: root/networking/traceroute.c
diff options
context:
space:
mode:
authorRob Landley2006-07-16 08:06:34 +0000
committerRob Landley2006-07-16 08:06:34 +0000
commitafb94ecf2bb6c53ce2a381d6ce45a426243c76d9 (patch)
tree0390f5cfb0cfd70882175f7e383a30d8cb1527cc /networking/traceroute.c
parent25c194fd1941a7ba67d68a09fa101bc54a756a14 (diff)
downloadbusybox-afb94ecf2bb6c53ce2a381d6ce45a426243c76d9.zip
busybox-afb94ecf2bb6c53ce2a381d6ce45a426243c76d9.tar.gz
Convert setuid/setgid users to xsetuid/xsetgid.
Diffstat (limited to 'networking/traceroute.c')
-rw-r--r--networking/traceroute.c8
1 files changed, 3 insertions, 5 deletions
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 @@ traceroute_main(int argc, char *argv[])
#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 @@ traceroute_main(int argc, char *argv[])
* 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 @@ traceroute_main(int argc, char *argv[])
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);