diff options
author | vda <vda@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2007-01-27 22:21:12 +0000 |
---|---|---|
committer | vda <vda@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2007-01-27 22:21:12 +0000 |
commit | c6bbd895662dff96ca89c577623e8f1c234b015f (patch) | |
tree | da3276ab5bc224a64fb9f7d7d2a8a046816ec533 /networking | |
parent | 68382a06482269331d897fa1a178bbc9625ae10c (diff) | |
download | busybox-w32-c6bbd895662dff96ca89c577623e8f1c234b015f.tar.gz busybox-w32-c6bbd895662dff96ca89c577623e8f1c234b015f.tar.bz2 busybox-w32-c6bbd895662dff96ca89c577623e8f1c234b015f.zip |
use bb_sanitize_stdio() where appropriate
git-svn-id: svn://busybox.net/trunk/busybox@17557 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to 'networking')
-rw-r--r-- | networking/traceroute.c | 6 | ||||
-rw-r--r-- | networking/udhcp/common.c | 16 |
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[]) | |||
1040 | bb_show_usage(); | 1040 | bb_show_usage(); |
1041 | } | 1041 | } |
1042 | 1042 | ||
1043 | /* Insure the socket fds won't be 0, 1 or 2 */ | 1043 | /* Ensure the socket fds won't be 0, 1 or 2 */ |
1044 | do n = xopen(bb_dev_null, O_RDONLY); while (n < 2); | 1044 | bb_sanitize_stdio(); |
1045 | while (n > 2) | ||
1046 | close(n--); | ||
1047 | 1045 | ||
1048 | s = xsocket(AF_INET, SOCK_RAW, IPPROTO_ICMP); | 1046 | s = xsocket(AF_INET, SOCK_RAW, IPPROTO_ICMP); |
1049 | 1047 | ||
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) | |||
22 | return info.uptime; | 22 | return info.uptime; |
23 | } | 23 | } |
24 | 24 | ||
25 | /* | ||
26 | * This function makes sure our first socket calls | ||
27 | * aren't going to fd 1 (printf badness...) and are | ||
28 | * not later closed by daemon() | ||
29 | */ | ||
30 | static inline void sanitize_fds(void) | ||
31 | { | ||
32 | int fd = xopen(bb_dev_null, O_RDWR); | ||
33 | while (fd < 3) | ||
34 | fd = dup(fd); | ||
35 | close(fd); | ||
36 | } | ||
37 | |||
38 | |||
39 | void udhcp_background(const char *pidfile) | 25 | void udhcp_background(const char *pidfile) |
40 | { | 26 | { |
41 | #ifdef __uClinux__ | 27 | #ifdef __uClinux__ |
@@ -57,7 +43,7 @@ void udhcp_start_log_and_pid(const char *pidfile) | |||
57 | int pid_fd; | 43 | int pid_fd; |
58 | 44 | ||
59 | /* Make sure our syslog fd isn't overwritten */ | 45 | /* Make sure our syslog fd isn't overwritten */ |
60 | sanitize_fds(); | 46 | bb_sanitize_stdio(); |
61 | 47 | ||
62 | /* do some other misc startup stuff while we are here to save bytes */ | 48 | /* do some other misc startup stuff while we are here to save bytes */ |
63 | pid_fd = pidfile_acquire(pidfile); | 49 | pid_fd = pidfile_acquire(pidfile); |