aboutsummaryrefslogtreecommitdiff
path: root/sysklogd
diff options
context:
space:
mode:
authorBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2006-04-12 17:55:51 +0000
committerBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2006-04-12 17:55:51 +0000
commitdac7ff15b7d32deeeef3d9665744fc5774c21d70 (patch)
tree0e4c34863628d79fdad0c6217f4deb0ca0a91c33 /sysklogd
parent79865bc5077cf6d17b27e9599921d4c85b1575fd (diff)
downloadbusybox-dac7ff15b7d32deeeef3d9665744fc5774c21d70.tar.gz
- patch from Denis Vlasenko to add and use bb_xsocket() and to use
bb_xopen some more while at it. Also use shorter boilerplate while at it.
Diffstat (limited to 'sysklogd')
-rw-r--r--sysklogd/syslogd.c13
1 files changed, 2 insertions, 11 deletions
diff --git a/sysklogd/syslogd.c b/sysklogd/syslogd.c
index bb8ba1b82..b43c72d66 100644
--- a/sysklogd/syslogd.c
+++ b/sysklogd/syslogd.c
@@ -369,12 +369,7 @@ static void message(char *fmt, ...)
static void init_RemoteLog(void)
{
memset(&remoteaddr, 0, sizeof(remoteaddr));
- remotefd = socket(AF_INET, SOCK_DGRAM, 0);
-
- if (remotefd < 0) {
- bb_error_msg("cannot create socket");
- }
-
+ remotefd = bb_xsocket(AF_INET, SOCK_DGRAM, 0);
remoteaddr.sin_family = AF_INET;
remoteaddr.sin_addr = *(struct in_addr *) *(xgethostbyname(RemoteHost))->h_addr_list;
remoteaddr.sin_port = htons(RemotePort);
@@ -543,11 +538,7 @@ static void doSyslogd(void)
memset(&sunx, 0, sizeof(sunx));
sunx.sun_family = AF_UNIX;
strncpy(sunx.sun_path, lfile, sizeof(sunx.sun_path));
- if ((sock_fd = socket(AF_UNIX, SOCK_DGRAM, 0)) < 0) {
- bb_perror_msg_and_die("Couldn't get file descriptor for socket "
- _PATH_LOG);
- }
-
+ sock_fd = bb_xsocket(AF_UNIX, SOCK_DGRAM, 0);
addrLength = sizeof(sunx.sun_family) + strlen(sunx.sun_path);
if (bind(sock_fd, (struct sockaddr *) &sunx, addrLength) < 0) {
bb_perror_msg_and_die("Could not connect to socket " _PATH_LOG);