aboutsummaryrefslogtreecommitdiff
path: root/sysklogd
diff options
context:
space:
mode:
Diffstat (limited to 'sysklogd')
-rw-r--r--sysklogd/syslogd.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/sysklogd/syslogd.c b/sysklogd/syslogd.c
index 5b153f509..ae3f1a2eb 100644
--- a/sysklogd/syslogd.c
+++ b/sysklogd/syslogd.c
@@ -471,8 +471,8 @@ static void do_syslogd(void) ATTRIBUTE_NORETURN;
471static void do_syslogd(void) 471static void do_syslogd(void)
472{ 472{
473 struct sockaddr_un sunx; 473 struct sockaddr_un sunx;
474 int sock_fd; 474 struct pollfd pfd[1];
475 fd_set fds; 475#define sock_fd (pfd[0].fd)
476 char *dev_log_name; 476 char *dev_log_name;
477 477
478 /* Set up signal handlers */ 478 /* Set up signal handlers */
@@ -526,20 +526,20 @@ static void do_syslogd(void)
526 (char*)"syslogd started: BusyBox v" BB_VER, 0); 526 (char*)"syslogd started: BusyBox v" BB_VER, 0);
527 527
528 for (;;) { 528 for (;;) {
529 FD_ZERO(&fds); 529 /*pfd[0].fd = sock_fd;*/
530 FD_SET(sock_fd, &fds); 530 pfd[0].events = POLLIN;
531 531 pfd[0].revents = 0;
532 if (select(sock_fd + 1, &fds, NULL, NULL, NULL) < 0) { 532 if (poll(pfd, 1, -1) < 0) { /* -1: no timeout */
533 if (errno == EINTR) { 533 if (errno == EINTR) {
534 /* alarm may have happened */ 534 /* alarm may have happened */
535 continue; 535 continue;
536 } 536 }
537 bb_perror_msg_and_die("select"); 537 bb_perror_msg_and_die("poll");
538 } 538 }
539 539
540 if (FD_ISSET(sock_fd, &fds)) { 540 if (pfd[0].revents) {
541 int i; 541 int i;
542 i = recv(sock_fd, G.recvbuf, MAX_READ - 1, 0); 542 i = read(sock_fd, G.recvbuf, MAX_READ - 1);
543 if (i <= 0) 543 if (i <= 0)
544 bb_perror_msg_and_die("UNIX socket error"); 544 bb_perror_msg_and_die("UNIX socket error");
545 /* TODO: maybe suppress duplicates? */ 545 /* TODO: maybe suppress duplicates? */
@@ -559,7 +559,7 @@ static void do_syslogd(void)
559#endif 559#endif
560 G.recvbuf[i] = '\0'; 560 G.recvbuf[i] = '\0';
561 split_escape_and_log(G.recvbuf, i); 561 split_escape_and_log(G.recvbuf, i);
562 } /* FD_ISSET() */ 562 }
563 } /* for */ 563 } /* for */
564} 564}
565 565