aboutsummaryrefslogtreecommitdiff
path: root/networking
diff options
context:
space:
mode:
authorGravatar Denis Vlasenko <vda.linux@googlemail.com>2007-01-27 22:21:12 +0000
committerGravatar Denis Vlasenko <vda.linux@googlemail.com>2007-01-27 22:21:12 +0000
commite06bed30cfcde7b9e320aff8a4c878c72416c4c4 (patch)
treeda3276ab5bc224a64fb9f7d7d2a8a046816ec533 /networking
parentcd75a96f0f9d446028cad7e4b9b9224e009752e1 (diff)
downloadbusybox-e06bed30cfcde7b9e320aff8a4c878c72416c4c4.tar.gz
busybox-e06bed30cfcde7b9e320aff8a4c878c72416c4c4.tar.bz2
use bb_sanitize_stdio() where appropriate
Diffstat (limited to 'networking')
-rw-r--r--networking/traceroute.c6
-rw-r--r--networking/udhcp/common.c16
2 files changed, 3 insertions, 19 deletions
diff --git a/networking/traceroute.c b/networking/traceroute.c
index 47775aa8a..25c6569bb 100644
--- a/networking/traceroute.c
+++ b/networking/traceroute.c
@@ -1040,10 +1040,8 @@ traceroute_main(int argc, char *argv[])
bb_show_usage();
}
- /* Insure the socket fds won't be 0, 1 or 2 */
- do n = xopen(bb_dev_null, O_RDONLY); while (n < 2);
- while (n > 2)
- close(n--);
+ /* Ensure the socket fds won't be 0, 1 or 2 */
+ bb_sanitize_stdio();
s = xsocket(AF_INET, SOCK_RAW, IPPROTO_ICMP);
diff --git a/networking/udhcp/common.c b/networking/udhcp/common.c
index 3e916f422..3704ba71a 100644
--- a/networking/udhcp/common.c
+++ b/networking/udhcp/common.c
@@ -22,20 +22,6 @@ long uptime(void)
return info.uptime;
}
-/*
- * This function makes sure our first socket calls
- * aren't going to fd 1 (printf badness...) and are
- * not later closed by daemon()
- */
-static inline void sanitize_fds(void)
-{
- int fd = xopen(bb_dev_null, O_RDWR);
- while (fd < 3)
- fd = dup(fd);
- close(fd);
-}
-
-
void udhcp_background(const char *pidfile)
{
#ifdef __uClinux__
@@ -57,7 +43,7 @@ void udhcp_start_log_and_pid(const char *pidfile)
int pid_fd;
/* Make sure our syslog fd isn't overwritten */
- sanitize_fds();
+ bb_sanitize_stdio();
/* do some other misc startup stuff while we are here to save bytes */
pid_fd = pidfile_acquire(pidfile);