diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2006-10-06 09:49:47 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2006-10-06 09:49:47 +0000 |
commit | c12f53090bd41dbb87279083bc442769cb0610f0 (patch) | |
tree | 079fff1c37f04ea7f25f00cdc4360d52a69b77c5 /sysklogd | |
parent | 4e6ceb44554d265eed24c414b9a201d51d00fee2 (diff) | |
download | busybox-w32-c12f53090bd41dbb87279083bc442769cb0610f0.tar.gz busybox-w32-c12f53090bd41dbb87279083bc442769cb0610f0.tar.bz2 busybox-w32-c12f53090bd41dbb87279083bc442769cb0610f0.zip |
dnsd fix; option_mask32 added. dnsd needs more love.
Diffstat (limited to 'sysklogd')
-rw-r--r-- | sysklogd/syslogd.c | 39 |
1 files changed, 19 insertions, 20 deletions
diff --git a/sysklogd/syslogd.c b/sysklogd/syslogd.c index 40b98c1cb..254d7e73c 100644 --- a/sysklogd/syslogd.c +++ b/sysklogd/syslogd.c | |||
@@ -55,7 +55,6 @@ static struct sockaddr_in remoteaddr; | |||
55 | #endif | 55 | #endif |
56 | 56 | ||
57 | /* options */ | 57 | /* options */ |
58 | static unsigned option_mask; | ||
59 | /* Correct regardless of combination of CONFIG_xxx */ | 58 | /* Correct regardless of combination of CONFIG_xxx */ |
60 | enum { | 59 | enum { |
61 | OPTBIT_mark = 0, // -m | 60 | OPTBIT_mark = 0, // -m |
@@ -298,7 +297,7 @@ static void message(char *fmt, ...) | |||
298 | fl.l_len = 1; | 297 | fl.l_len = 1; |
299 | 298 | ||
300 | #ifdef CONFIG_FEATURE_IPC_SYSLOG | 299 | #ifdef CONFIG_FEATURE_IPC_SYSLOG |
301 | if ((option_mask & OPT_circularlog) && shbuf) { | 300 | if ((option_mask32 & OPT_circularlog) && shbuf) { |
302 | char b[1024]; | 301 | char b[1024]; |
303 | 302 | ||
304 | va_start(arguments, fmt); | 303 | va_start(arguments, fmt); |
@@ -404,7 +403,7 @@ static void logMessage(int pri, char *msg) | |||
404 | /* todo: supress duplicates */ | 403 | /* todo: supress duplicates */ |
405 | 404 | ||
406 | #ifdef CONFIG_FEATURE_REMOTE_LOG | 405 | #ifdef CONFIG_FEATURE_REMOTE_LOG |
407 | if (option_mask & OPT_remotelog) { | 406 | if (option_mask32 & OPT_remotelog) { |
408 | char line[MAXLINE + 1]; | 407 | char line[MAXLINE + 1]; |
409 | /* trying connect the socket */ | 408 | /* trying connect the socket */ |
410 | if (-1 == remotefd) { | 409 | if (-1 == remotefd) { |
@@ -419,12 +418,12 @@ static void logMessage(int pri, char *msg) | |||
419 | } | 418 | } |
420 | } | 419 | } |
421 | 420 | ||
422 | if (option_mask & OPT_locallog) | 421 | if (option_mask32 & OPT_locallog) |
423 | #endif | 422 | #endif |
424 | { | 423 | { |
425 | /* now spew out the message to wherever it is supposed to go */ | 424 | /* now spew out the message to wherever it is supposed to go */ |
426 | if (pri == 0 || LOG_PRI(pri) < logLevel) { | 425 | if (pri == 0 || LOG_PRI(pri) < logLevel) { |
427 | if (option_mask & OPT_small) | 426 | if (option_mask32 & OPT_small) |
428 | message("%s %s\n", timestamp, msg); | 427 | message("%s %s\n", timestamp, msg); |
429 | else | 428 | else |
430 | message("%s %s %s %s\n", timestamp, LocalHostName, res, msg); | 429 | message("%s %s %s %s\n", timestamp, LocalHostName, res, msg); |
@@ -531,7 +530,7 @@ static void doSyslogd(void) | |||
531 | if (chmod(lfile, 0666) < 0) { | 530 | if (chmod(lfile, 0666) < 0) { |
532 | bb_perror_msg_and_die("cannot set permission on %s", lfile); | 531 | bb_perror_msg_and_die("cannot set permission on %s", lfile); |
533 | } | 532 | } |
534 | if (ENABLE_FEATURE_IPC_SYSLOG && (option_mask & OPT_circularlog)) { | 533 | if (ENABLE_FEATURE_IPC_SYSLOG && (option_mask32 & OPT_circularlog)) { |
535 | ipcsyslog_init(); | 534 | ipcsyslog_init(); |
536 | } | 535 | } |
537 | 536 | ||
@@ -575,26 +574,26 @@ int syslogd_main(int argc, char **argv) | |||
575 | char *p; | 574 | char *p; |
576 | 575 | ||
577 | /* do normal option parsing */ | 576 | /* do normal option parsing */ |
578 | option_mask = getopt32(argc, argv, OPTION_STR, OPTION_PARAM); | 577 | getopt32(argc, argv, OPTION_STR, OPTION_PARAM); |
579 | if (option_mask & OPT_mark) MarkInterval = atoi(opt_m) * 60; // -m | 578 | if (option_mask32 & OPT_mark) MarkInterval = atoi(opt_m) * 60; // -m |
580 | //if (option_mask & OPT_nofork) // -n | 579 | //if (option_mask32 & OPT_nofork) // -n |
581 | //if (option_mask & OPT_outfile) // -O | 580 | //if (option_mask32 & OPT_outfile) // -O |
582 | if (option_mask & OPT_loglevel) { // -l | 581 | if (option_mask32 & OPT_loglevel) { // -l |
583 | logLevel = atoi(opt_l); | 582 | logLevel = atoi(opt_l); |
584 | /* Valid levels are between 1 and 8 */ | 583 | /* Valid levels are between 1 and 8 */ |
585 | if (logLevel < 1 || logLevel > 8) | 584 | if (logLevel < 1 || logLevel > 8) |
586 | bb_show_usage(); | 585 | bb_show_usage(); |
587 | } | 586 | } |
588 | //if (option_mask & OPT_small) // -S | 587 | //if (option_mask32 & OPT_small) // -S |
589 | #if ENABLE_FEATURE_ROTATE_LOGFILE | 588 | #if ENABLE_FEATURE_ROTATE_LOGFILE |
590 | if (option_mask & OPT_filesize) logFileSize = atoi(opt_s) * 1024; // -s | 589 | if (option_mask32 & OPT_filesize) logFileSize = atoi(opt_s) * 1024; // -s |
591 | if (option_mask & OPT_rotatecnt) { // -b | 590 | if (option_mask32 & OPT_rotatecnt) { // -b |
592 | logFileRotate = atoi(opt_b); | 591 | logFileRotate = atoi(opt_b); |
593 | if (logFileRotate > 99) logFileRotate = 99; | 592 | if (logFileRotate > 99) logFileRotate = 99; |
594 | } | 593 | } |
595 | #endif | 594 | #endif |
596 | #if ENABLE_FEATURE_REMOTE_LOG | 595 | #if ENABLE_FEATURE_REMOTE_LOG |
597 | if (option_mask & OPT_remotelog) { // -R | 596 | if (option_mask32 & OPT_remotelog) { // -R |
598 | int port = 514; | 597 | int port = 514; |
599 | char *host = xstrdup(opt_R); | 598 | char *host = xstrdup(opt_R); |
600 | p = strchr(host, ':'); | 599 | p = strchr(host, ':'); |
@@ -608,10 +607,10 @@ int syslogd_main(int argc, char **argv) | |||
608 | remoteaddr.sin_port = htons(port); | 607 | remoteaddr.sin_port = htons(port); |
609 | free(host); | 608 | free(host); |
610 | } | 609 | } |
611 | //if (option_mask & OPT_locallog) // -L | 610 | //if (option_mask32 & OPT_locallog) // -L |
612 | #endif | 611 | #endif |
613 | #if ENABLE_FEATURE_IPC_SYSLOG | 612 | #if ENABLE_FEATURE_IPC_SYSLOG |
614 | if (option_mask & OPT_circularlog) { // -C | 613 | if (option_mask32 & OPT_circularlog) { // -C |
615 | if (opt_C) { | 614 | if (opt_C) { |
616 | int buf_size = atoi(opt_C); | 615 | int buf_size = atoi(opt_C); |
617 | if (buf_size >= 4) | 616 | if (buf_size >= 4) |
@@ -621,8 +620,8 @@ int syslogd_main(int argc, char **argv) | |||
621 | #endif | 620 | #endif |
622 | 621 | ||
623 | /* If they have not specified remote logging, then log locally */ | 622 | /* If they have not specified remote logging, then log locally */ |
624 | if (ENABLE_FEATURE_REMOTE_LOG && !(option_mask & OPT_remotelog)) | 623 | if (ENABLE_FEATURE_REMOTE_LOG && !(option_mask32 & OPT_remotelog)) |
625 | option_mask |= OPT_locallog; | 624 | option_mask32 |= OPT_locallog; |
626 | 625 | ||
627 | /* Store away localhost's name before the fork */ | 626 | /* Store away localhost's name before the fork */ |
628 | gethostname(LocalHostName, sizeof(LocalHostName)); | 627 | gethostname(LocalHostName, sizeof(LocalHostName)); |
@@ -633,7 +632,7 @@ int syslogd_main(int argc, char **argv) | |||
633 | 632 | ||
634 | umask(0); | 633 | umask(0); |
635 | 634 | ||
636 | if (!(option_mask & OPT_nofork)) { | 635 | if (!(option_mask32 & OPT_nofork)) { |
637 | #ifdef BB_NOMMU | 636 | #ifdef BB_NOMMU |
638 | vfork_daemon_rexec(0, 1, argc, argv, "-n"); | 637 | vfork_daemon_rexec(0, 1, argc, argv, "-n"); |
639 | #else | 638 | #else |