From dac7ff15b7d32deeeef3d9665744fc5774c21d70 Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Wed, 12 Apr 2006 17:55:51 +0000 Subject: - 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. --- sysklogd/syslogd.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) (limited to 'sysklogd') 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); -- cgit v1.2.3