aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sysklogd/syslogd.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/sysklogd/syslogd.c b/sysklogd/syslogd.c
index fbb85338a..01120757b 100644
--- a/sysklogd/syslogd.c
+++ b/sysklogd/syslogd.c
@@ -58,16 +58,16 @@ static struct sockaddr_in remoteAddr;
58 58
59/* We are using bb_common_bufsiz1 for buffering: */ 59/* We are using bb_common_bufsiz1 for buffering: */
60enum { MAX_READ = (BUFSIZ/6) & ~0xf }; 60enum { MAX_READ = (BUFSIZ/6) & ~0xf };
61/* We recv into this... (size: MAX_READ ~== BUFSIZ/6) */ 61/* We recv into RECVBUF... (size: MAX_READ ~== BUFSIZ/6) */
62#define RECVBUF bb_common_bufsiz1 62#define RECVBUF bb_common_bufsiz1
63/* ...then copy here, escaping control chars */ 63/* ...then copy to PARSEBUF, escaping control chars */
64/* (can grow x2 + 1 max ~== BUFSIZ/3) */ 64/* (can grow x2 max ~== BUFSIZ/3) */
65#define PARSEBUF (bb_common_bufsiz1 + MAX_READ) 65#define PARSEBUF (bb_common_bufsiz1 + MAX_READ)
66/* ...then sprintf into this, adding timestamp (15 chars), 66/* ...then sprintf into PRINTBUF, adding timestamp (15 chars),
67 * host (64), fac.prio (20) to the message */ 67 * host (64), fac.prio (20) to the message */
68/* (growth by: 15 + 64 + 20 + delims = ~110) */ 68/* (growth by: 15 + 64 + 20 + delims = ~110) */
69#define PRINTBUF (bb_common_bufsiz1 + 3*MAX_READ + 0x10) 69#define PRINTBUF (bb_common_bufsiz1 + 3*MAX_READ)
70/* totals: BUFSIZ/6 + BUFSIZ/3 + BUFSIZ/3 = BUFSIZ - BUFSIZ/6 70/* totals: BUFSIZ == BUFSIZ/6 + BUFSIZ/3 + (BUFSIZ/3+BUFSIZ/6)
71 * -- we have BUFSIZ/6 extra at the ent of PRINTBUF 71 * -- we have BUFSIZ/6 extra at the ent of PRINTBUF
72 * which covers needed ~110 extra bytes (and much more) */ 72 * which covers needed ~110 extra bytes (and much more) */
73 73
@@ -467,7 +467,7 @@ static void do_syslogd(void)
467 int sock_fd; 467 int sock_fd;
468 fd_set fds; 468 fd_set fds;
469 469
470 /* Set up signal handlers. */ 470 /* Set up signal handlers */
471 signal(SIGINT, quit_signal); 471 signal(SIGINT, quit_signal);
472 signal(SIGTERM, quit_signal); 472 signal(SIGTERM, quit_signal);
473 signal(SIGQUIT, quit_signal); 473 signal(SIGQUIT, quit_signal);
@@ -510,7 +510,7 @@ static void do_syslogd(void)
510 510
511 if (select(sock_fd + 1, &fds, NULL, NULL, NULL) < 0) { 511 if (select(sock_fd + 1, &fds, NULL, NULL, NULL) < 0) {
512 if (errno == EINTR) { 512 if (errno == EINTR) {
513 /* alarm may have happened. */ 513 /* alarm may have happened */
514 continue; 514 continue;
515 } 515 }
516 bb_perror_msg_and_die("select"); 516 bb_perror_msg_and_die("select");
@@ -604,6 +604,5 @@ int syslogd_main(int argc, char **argv)
604 } 604 }
605 umask(0); 605 umask(0);
606 do_syslogd(); 606 do_syslogd();
607 607 /* return EXIT_SUCCESS; */
608 return EXIT_SUCCESS;
609} 608}