aboutsummaryrefslogtreecommitdiff
path: root/sysklogd/syslogd.c
diff options
context:
space:
mode:
Diffstat (limited to 'sysklogd/syslogd.c')
-rw-r--r--sysklogd/syslogd.c34
1 files changed, 17 insertions, 17 deletions
diff --git a/sysklogd/syslogd.c b/sysklogd/syslogd.c
index 1c58a64f8..b912f5f8f 100644
--- a/sysklogd/syslogd.c
+++ b/sysklogd/syslogd.c
@@ -123,7 +123,7 @@ static int circular_logging = FALSE;
123static inline void sem_up(int semid) 123static inline void sem_up(int semid)
124{ 124{
125 if (semop(semid, SMwup, 1) == -1) { 125 if (semop(semid, SMwup, 1) == -1) {
126 perror_msg_and_die("semop[SMwup]"); 126 bb_perror_msg_and_die("semop[SMwup]");
127 } 127 }
128} 128}
129 129
@@ -133,7 +133,7 @@ static inline void sem_up(int semid)
133static inline void sem_down(int semid) 133static inline void sem_down(int semid)
134{ 134{
135 if (semop(semid, SMwdn, 3) == -1) { 135 if (semop(semid, SMwdn, 3) == -1) {
136 perror_msg_and_die("semop[SMwdn]"); 136 bb_perror_msg_and_die("semop[SMwdn]");
137 } 137 }
138} 138}
139 139
@@ -157,11 +157,11 @@ void ipcsyslog_init(void)
157{ 157{
158 if (buf == NULL) { 158 if (buf == NULL) {
159 if ((shmid = shmget(KEY_ID, shm_size, IPC_CREAT | 1023)) == -1) { 159 if ((shmid = shmget(KEY_ID, shm_size, IPC_CREAT | 1023)) == -1) {
160 perror_msg_and_die("shmget"); 160 bb_perror_msg_and_die("shmget");
161 } 161 }
162 162
163 if ((buf = shmat(shmid, NULL, 0)) == NULL) { 163 if ((buf = shmat(shmid, NULL, 0)) == NULL) {
164 perror_msg_and_die("shmat"); 164 bb_perror_msg_and_die("shmat");
165 } 165 }
166 166
167 buf->size = data_size; 167 buf->size = data_size;
@@ -171,10 +171,10 @@ void ipcsyslog_init(void)
171 if ((s_semid = semget(KEY_ID, 2, IPC_CREAT | IPC_EXCL | 1023)) == -1) { 171 if ((s_semid = semget(KEY_ID, 2, IPC_CREAT | IPC_EXCL | 1023)) == -1) {
172 if (errno == EEXIST) { 172 if (errno == EEXIST) {
173 if ((s_semid = semget(KEY_ID, 2, 0)) == -1) { 173 if ((s_semid = semget(KEY_ID, 2, 0)) == -1) {
174 perror_msg_and_die("semget"); 174 bb_perror_msg_and_die("semget");
175 } 175 }
176 } else { 176 } else {
177 perror_msg_and_die("semget"); 177 bb_perror_msg_and_die("semget");
178 } 178 }
179 } 179 }
180 } else { 180 } else {
@@ -471,7 +471,7 @@ static void init_RemoteLog(void)
471 remotefd = socket(AF_INET, SOCK_DGRAM, 0); 471 remotefd = socket(AF_INET, SOCK_DGRAM, 0);
472 472
473 if (remotefd < 0) { 473 if (remotefd < 0) {
474 error_msg_and_die("cannot create socket"); 474 bb_error_msg_and_die("cannot create socket");
475 } 475 }
476 476
477 hostinfo = xgethostbyname(RemoteHost); 477 hostinfo = xgethostbyname(RemoteHost);
@@ -484,7 +484,7 @@ static void init_RemoteLog(void)
484 * for future operations 484 * for future operations
485 */ 485 */
486 if (0 != (connect(remotefd, (struct sockaddr *) &remoteaddr, len))) { 486 if (0 != (connect(remotefd, (struct sockaddr *) &remoteaddr, len))) {
487 error_msg_and_die("cannot connect to remote host %s:%d", RemoteHost, 487 bb_error_msg_and_die("cannot connect to remote host %s:%d", RemoteHost,
488 RemotePort); 488 RemotePort);
489 } 489 }
490 490
@@ -521,17 +521,17 @@ static void doSyslogd(void)
521 sunx.sun_family = AF_UNIX; 521 sunx.sun_family = AF_UNIX;
522 strncpy(sunx.sun_path, lfile, sizeof(sunx.sun_path)); 522 strncpy(sunx.sun_path, lfile, sizeof(sunx.sun_path));
523 if ((sock_fd = socket(AF_UNIX, SOCK_DGRAM, 0)) < 0) { 523 if ((sock_fd = socket(AF_UNIX, SOCK_DGRAM, 0)) < 0) {
524 perror_msg_and_die("Couldn't get file descriptor for socket " 524 bb_perror_msg_and_die("Couldn't get file descriptor for socket "
525 _PATH_LOG); 525 _PATH_LOG);
526 } 526 }
527 527
528 addrLength = sizeof(sunx.sun_family) + strlen(sunx.sun_path); 528 addrLength = sizeof(sunx.sun_family) + strlen(sunx.sun_path);
529 if (bind(sock_fd, (struct sockaddr *) &sunx, addrLength) < 0) { 529 if (bind(sock_fd, (struct sockaddr *) &sunx, addrLength) < 0) {
530 perror_msg_and_die("Could not connect to socket " _PATH_LOG); 530 bb_perror_msg_and_die("Could not connect to socket " _PATH_LOG);
531 } 531 }
532 532
533 if (chmod(lfile, 0666) < 0) { 533 if (chmod(lfile, 0666) < 0) {
534 perror_msg_and_die("Could not set permission on " _PATH_LOG); 534 bb_perror_msg_and_die("Could not set permission on " _PATH_LOG);
535 } 535 }
536#ifdef CONFIG_FEATURE_IPC_SYSLOG 536#ifdef CONFIG_FEATURE_IPC_SYSLOG
537 if (circular_logging == TRUE) { 537 if (circular_logging == TRUE) {
@@ -557,7 +557,7 @@ static void doSyslogd(void)
557 /* alarm may have happened. */ 557 /* alarm may have happened. */
558 continue; 558 continue;
559 } 559 }
560 perror_msg_and_die("select error"); 560 bb_perror_msg_and_die("select error");
561 } 561 }
562 562
563 if (FD_ISSET(sock_fd, &fds)) { 563 if (FD_ISSET(sock_fd, &fds)) {
@@ -569,7 +569,7 @@ static void doSyslogd(void)
569 if ((i = recv(sock_fd, tmpbuf, BUFSIZ, 0)) > 0) { 569 if ((i = recv(sock_fd, tmpbuf, BUFSIZ, 0)) > 0) {
570 serveConnection(tmpbuf, i); 570 serveConnection(tmpbuf, i);
571 } else { 571 } else {
572 perror_msg_and_die("UNIX socket error"); 572 bb_perror_msg_and_die("UNIX socket error");
573 } 573 }
574 RELEASE_CONFIG_BUFFER(tmpbuf); 574 RELEASE_CONFIG_BUFFER(tmpbuf);
575 } /* FD_ISSET() */ 575 } /* FD_ISSET() */
@@ -598,11 +598,11 @@ extern int syslogd_main(int argc, char **argv)
598 break; 598 break;
599#endif 599#endif
600 case 'O': 600 case 'O':
601 logFilePath = xstrdup(optarg); 601 logFilePath = bb_xstrdup(optarg);
602 break; 602 break;
603#ifdef CONFIG_FEATURE_REMOTE_LOG 603#ifdef CONFIG_FEATURE_REMOTE_LOG
604 case 'R': 604 case 'R':
605 RemoteHost = xstrdup(optarg); 605 RemoteHost = bb_xstrdup(optarg);
606 if ((p = strchr(RemoteHost, ':'))) { 606 if ((p = strchr(RemoteHost, ':'))) {
607 RemotePort = atoi(p + 1); 607 RemotePort = atoi(p + 1);
608 *p = '\0'; 608 *p = '\0';
@@ -619,7 +619,7 @@ extern int syslogd_main(int argc, char **argv)
619 break; 619 break;
620#endif 620#endif
621 default: 621 default:
622 show_usage(); 622 bb_show_usage();
623 } 623 }
624 } 624 }
625 625
@@ -640,7 +640,7 @@ extern int syslogd_main(int argc, char **argv)
640 640
641#if ! defined(__uClinux__) 641#if ! defined(__uClinux__)
642 if ((doFork == TRUE) && (daemon(0, 1) < 0)) { 642 if ((doFork == TRUE) && (daemon(0, 1) < 0)) {
643 perror_msg_and_die("daemon"); 643 bb_perror_msg_and_die("daemon");
644 } 644 }
645#endif 645#endif
646 doSyslogd(); 646 doSyslogd();