replacing func() with xfunc() where appropriate

This commit is contained in:
Denis Vlasenko 2006-09-03 12:21:59 +00:00
parent 87d80dcc3e
commit 27af5a0dd3
6 changed files with 12 additions and 21 deletions

View File

@ -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,

View File

@ -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);

View File

@ -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");

View File

@ -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__ */

View File

@ -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);
}