diff options
Diffstat (limited to 'networking')
-rw-r--r-- | networking/arping.c | 7 | ||||
-rw-r--r-- | networking/fakeidentd.c | 2 | ||||
-rw-r--r-- | networking/libiproute/iptunnel.c | 12 | ||||
-rw-r--r-- | networking/udhcp/common.c | 5 | ||||
-rw-r--r-- | networking/zcip.c | 5 |
5 files changed, 11 insertions, 20 deletions
diff --git a/networking/arping.c b/networking/arping.c index 5665ddb..08b2727 100644 --- a/networking/arping.c +++ b/networking/arping.c @@ -259,7 +259,7 @@ int arping_main(int argc, char **argv) char *source = NULL; char *target; - s = socket(PF_PACKET, SOCK_DGRAM, 0); + s = xsocket(PF_PACKET, SOCK_DGRAM, 0); ifindex = errno; // Drop suid root privileges @@ -346,11 +346,8 @@ int arping_main(int argc, char **argv) if (!(cfg&dad) || src.s_addr) { struct sockaddr_in saddr; - int probe_fd = socket(AF_INET, SOCK_DGRAM, 0); /* maybe use bb_xsocket? */ + int probe_fd = xsocket(AF_INET, SOCK_DGRAM, 0); - if (probe_fd < 0) { - bb_error_msg_and_die("socket"); - } if (device) { if (setsockopt (probe_fd, SOL_SOCKET, SO_BINDTODEVICE, device, diff --git a/networking/fakeidentd.c b/networking/fakeidentd.c index b965147..29e09d1 100644 --- a/networking/fakeidentd.c +++ b/networking/fakeidentd.c @@ -135,7 +135,7 @@ static int godaemon(void) switch (fork()) { case -1: - bb_perror_msg_and_die("Could not fork"); + bb_perror_msg_and_die("fork"); case 0: pw = getpwnam(nobodystr); diff --git a/networking/libiproute/iptunnel.c b/networking/libiproute/iptunnel.c index 4524d49..806d865 100644 --- a/networking/libiproute/iptunnel.c +++ b/networking/libiproute/iptunnel.c @@ -43,7 +43,7 @@ static int do_ioctl_get_ifindex(char *dev) int fd; strcpy(ifr.ifr_name, dev); - fd = socket(AF_INET, SOCK_DGRAM, 0); + fd = xsocket(AF_INET, SOCK_DGRAM, 0); if (ioctl(fd, SIOCGIFINDEX, &ifr)) { bb_perror_msg("ioctl"); return 0; @@ -58,7 +58,7 @@ static int do_ioctl_get_iftype(char *dev) int fd; strcpy(ifr.ifr_name, dev); - fd = socket(AF_INET, SOCK_DGRAM, 0); + fd = xsocket(AF_INET, SOCK_DGRAM, 0); if (ioctl(fd, SIOCGIFHWADDR, &ifr)) { bb_perror_msg("ioctl"); return -1; @@ -74,7 +74,7 @@ static char *do_ioctl_get_ifname(int idx) int fd; ifr.ifr_ifindex = idx; - fd = socket(AF_INET, SOCK_DGRAM, 0); + fd = xsocket(AF_INET, SOCK_DGRAM, 0); if (ioctl(fd, SIOCGIFNAME, &ifr)) { bb_perror_msg("ioctl"); return NULL; @@ -93,7 +93,7 @@ static int do_get_ioctl(char *basedev, struct ip_tunnel_parm *p) strcpy(ifr.ifr_name, basedev); ifr.ifr_ifru.ifru_data = (void*)p; - fd = socket(AF_INET, SOCK_DGRAM, 0); + fd = xsocket(AF_INET, SOCK_DGRAM, 0); err = ioctl(fd, SIOCGETTUNNEL, &ifr); if (err) { bb_perror_msg("ioctl"); @@ -114,7 +114,7 @@ static int do_add_ioctl(int cmd, char *basedev, struct ip_tunnel_parm *p) strcpy(ifr.ifr_name, basedev); } ifr.ifr_ifru.ifru_data = (void*)p; - fd = socket(AF_INET, SOCK_DGRAM, 0); + fd = xsocket(AF_INET, SOCK_DGRAM, 0); err = ioctl(fd, cmd, &ifr); if (err) { bb_perror_msg("ioctl"); @@ -135,7 +135,7 @@ static int do_del_ioctl(char *basedev, struct ip_tunnel_parm *p) strcpy(ifr.ifr_name, basedev); } ifr.ifr_ifru.ifru_data = (void*)p; - fd = socket(AF_INET, SOCK_DGRAM, 0); + fd = xsocket(AF_INET, SOCK_DGRAM, 0); err = ioctl(fd, SIOCDELTUNNEL, &ifr); if (err) { bb_perror_msg("ioctl"); diff --git a/networking/udhcp/common.c b/networking/udhcp/common.c index 2c902fc..c2025e5 100644 --- a/networking/udhcp/common.c +++ b/networking/udhcp/common.c @@ -59,10 +59,7 @@ void udhcp_background(const char *pidfile) /* hold lock during fork. */ pid_fd = pidfile_acquire(pidfile); - if (daemon(0, 0) == -1) { /* bb_xdaemon? */ - perror("fork"); - exit(1); - } + xdaemon(0, 0); daemonized++; pidfile_write_release(pid_fd); #endif /* __uClinux__ */ diff --git a/networking/zcip.c b/networking/zcip.c index 8e6d879..e9dd050 100644 --- a/networking/zcip.c +++ b/networking/zcip.c @@ -288,10 +288,7 @@ fail: // daemonize now; don't delay system startup if (!foreground) { - if (daemon(0, verbose) < 0) { - why = "daemon"; - goto bad; - } + xdaemon(0, verbose); syslog(LOG_INFO, "start, interface %s", intf); } |