diff options
author | aldot <aldot@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2006-04-12 17:55:51 +0000 |
---|---|---|
committer | aldot <aldot@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2006-04-12 17:55:51 +0000 |
commit | 00657c96b9b3963230d89ccc3dc2959d034673e7 (patch) | |
tree | 0e4c34863628d79fdad0c6217f4deb0ca0a91c33 /sysklogd/syslogd.c | |
parent | fa6199c4ed8fdbb6901f43a06fb22d37e6e9b9e1 (diff) | |
download | busybox-w32-00657c96b9b3963230d89ccc3dc2959d034673e7.tar.gz busybox-w32-00657c96b9b3963230d89ccc3dc2959d034673e7.tar.bz2 busybox-w32-00657c96b9b3963230d89ccc3dc2959d034673e7.zip |
- 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.
git-svn-id: svn://busybox.net/trunk/busybox@14833 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to 'sysklogd/syslogd.c')
-rw-r--r-- | sysklogd/syslogd.c | 13 |
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, ...) | |||
369 | static void init_RemoteLog(void) | 369 | static void init_RemoteLog(void) |
370 | { | 370 | { |
371 | memset(&remoteaddr, 0, sizeof(remoteaddr)); | 371 | memset(&remoteaddr, 0, sizeof(remoteaddr)); |
372 | remotefd = socket(AF_INET, SOCK_DGRAM, 0); | 372 | remotefd = bb_xsocket(AF_INET, SOCK_DGRAM, 0); |
373 | |||
374 | if (remotefd < 0) { | ||
375 | bb_error_msg("cannot create socket"); | ||
376 | } | ||
377 | |||
378 | remoteaddr.sin_family = AF_INET; | 373 | remoteaddr.sin_family = AF_INET; |
379 | remoteaddr.sin_addr = *(struct in_addr *) *(xgethostbyname(RemoteHost))->h_addr_list; | 374 | remoteaddr.sin_addr = *(struct in_addr *) *(xgethostbyname(RemoteHost))->h_addr_list; |
380 | remoteaddr.sin_port = htons(RemotePort); | 375 | remoteaddr.sin_port = htons(RemotePort); |
@@ -543,11 +538,7 @@ static void doSyslogd(void) | |||
543 | memset(&sunx, 0, sizeof(sunx)); | 538 | memset(&sunx, 0, sizeof(sunx)); |
544 | sunx.sun_family = AF_UNIX; | 539 | sunx.sun_family = AF_UNIX; |
545 | strncpy(sunx.sun_path, lfile, sizeof(sunx.sun_path)); | 540 | strncpy(sunx.sun_path, lfile, sizeof(sunx.sun_path)); |
546 | if ((sock_fd = socket(AF_UNIX, SOCK_DGRAM, 0)) < 0) { | 541 | sock_fd = bb_xsocket(AF_UNIX, SOCK_DGRAM, 0); |
547 | bb_perror_msg_and_die("Couldn't get file descriptor for socket " | ||
548 | _PATH_LOG); | ||
549 | } | ||
550 | |||
551 | addrLength = sizeof(sunx.sun_family) + strlen(sunx.sun_path); | 542 | addrLength = sizeof(sunx.sun_family) + strlen(sunx.sun_path); |
552 | if (bind(sock_fd, (struct sockaddr *) &sunx, addrLength) < 0) { | 543 | if (bind(sock_fd, (struct sockaddr *) &sunx, addrLength) < 0) { |
553 | bb_perror_msg_and_die("Could not connect to socket " _PATH_LOG); | 544 | bb_perror_msg_and_die("Could not connect to socket " _PATH_LOG); |