summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Vlasenko2006-09-03 12:21:59 +0000
committerDenis Vlasenko2006-09-03 12:21:59 +0000
commit27af5a0dd34b1b392aa69b548e18935aafe66e5f (patch)
tree0de777f153dec72a0339c12d360e8bf156d17b45
parent87d80dcc3e81d80caa11ed88fe6136ffe3e605dc (diff)
downloadbusybox-27af5a0dd34b1b392aa69b548e18935aafe66e5f.zip
busybox-27af5a0dd34b1b392aa69b548e18935aafe66e5f.tar.gz
replacing func() with xfunc() where appropriate
-rw-r--r--libbb/xfuncs.c2
-rw-r--r--networking/arping.c7
-rw-r--r--networking/fakeidentd.c2
-rw-r--r--networking/libiproute/iptunnel.c12
-rw-r--r--networking/udhcp/common.c5
-rw-r--r--networking/zcip.c5
6 files changed, 12 insertions, 21 deletions
diff --git a/libbb/xfuncs.c b/libbb/xfuncs.c
index b2b53a7..116cff4 100644
--- a/libbb/xfuncs.c
+++ b/libbb/xfuncs.c
@@ -454,7 +454,7 @@ DIR *xopendir(const char *path)
/* Die with an error message if we can't daemonize. */
void xdaemon(int nochdir, int noclose)
{
- if (daemon(nochdir, noclose)) bb_perror_msg_and_die("daemon");
+ if (daemon(nochdir, noclose)) bb_perror_msg_and_die("daemon");
}
#endif
#endif
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);
}