diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2006-10-08 12:49:22 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2006-10-08 12:49:22 +0000 |
commit | 1385899416a4396385ad421ae1f532be7103738a (patch) | |
tree | fc4d14a910593d1235318bb36abe5e9f72d2039e /sysklogd/syslogd.c | |
parent | 5625415085e68ac5e150f54e685417c866620d76 (diff) | |
download | busybox-w32-1385899416a4396385ad421ae1f532be7103738a.tar.gz busybox-w32-1385899416a4396385ad421ae1f532be7103738a.tar.bz2 busybox-w32-1385899416a4396385ad421ae1f532be7103738a.zip |
attempt to regularize atoi mess.
Diffstat (limited to 'sysklogd/syslogd.c')
-rw-r--r-- | sysklogd/syslogd.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/sysklogd/syslogd.c b/sysklogd/syslogd.c index 254d7e73c..9e030bd63 100644 --- a/sysklogd/syslogd.c +++ b/sysklogd/syslogd.c | |||
@@ -575,20 +575,20 @@ int syslogd_main(int argc, char **argv) | |||
575 | 575 | ||
576 | /* do normal option parsing */ | 576 | /* do normal option parsing */ |
577 | getopt32(argc, argv, OPTION_STR, OPTION_PARAM); | 577 | getopt32(argc, argv, OPTION_STR, OPTION_PARAM); |
578 | if (option_mask32 & OPT_mark) MarkInterval = atoi(opt_m) * 60; // -m | 578 | if (option_mask32 & OPT_mark) MarkInterval = xatoul_range(opt_m, 0, INT_MAX/60) * 60; // -m |
579 | //if (option_mask32 & OPT_nofork) // -n | 579 | //if (option_mask32 & OPT_nofork) // -n |
580 | //if (option_mask32 & OPT_outfile) // -O | 580 | //if (option_mask32 & OPT_outfile) // -O |
581 | if (option_mask32 & OPT_loglevel) { // -l | 581 | if (option_mask32 & OPT_loglevel) { // -l |
582 | logLevel = atoi(opt_l); | 582 | logLevel = xatoi_u(opt_l); |
583 | /* Valid levels are between 1 and 8 */ | 583 | /* Valid levels are between 1 and 8 */ |
584 | if (logLevel < 1 || logLevel > 8) | 584 | if (logLevel < 1 || logLevel > 8) |
585 | bb_show_usage(); | 585 | bb_show_usage(); |
586 | } | 586 | } |
587 | //if (option_mask32 & OPT_small) // -S | 587 | //if (option_mask32 & OPT_small) // -S |
588 | #if ENABLE_FEATURE_ROTATE_LOGFILE | 588 | #if ENABLE_FEATURE_ROTATE_LOGFILE |
589 | if (option_mask32 & OPT_filesize) logFileSize = atoi(opt_s) * 1024; // -s | 589 | if (option_mask32 & OPT_filesize) logFileSize = xatoul_range(opt_s, 0, INT_MAX/1024) * 1024; // -s |
590 | if (option_mask32 & OPT_rotatecnt) { // -b | 590 | if (option_mask32 & OPT_rotatecnt) { // -b |
591 | logFileRotate = atoi(opt_b); | 591 | logFileRotate = xatoi_u(opt_b); |
592 | if (logFileRotate > 99) logFileRotate = 99; | 592 | if (logFileRotate > 99) logFileRotate = 99; |
593 | } | 593 | } |
594 | #endif | 594 | #endif |
@@ -598,7 +598,7 @@ int syslogd_main(int argc, char **argv) | |||
598 | char *host = xstrdup(opt_R); | 598 | char *host = xstrdup(opt_R); |
599 | p = strchr(host, ':'); | 599 | p = strchr(host, ':'); |
600 | if (p) { | 600 | if (p) { |
601 | port = atoi(p + 1); | 601 | port = xatou16(p + 1); |
602 | *p = '\0'; | 602 | *p = '\0'; |
603 | } | 603 | } |
604 | remoteaddr.sin_family = AF_INET; | 604 | remoteaddr.sin_family = AF_INET; |
@@ -612,9 +612,7 @@ int syslogd_main(int argc, char **argv) | |||
612 | #if ENABLE_FEATURE_IPC_SYSLOG | 612 | #if ENABLE_FEATURE_IPC_SYSLOG |
613 | if (option_mask32 & OPT_circularlog) { // -C | 613 | if (option_mask32 & OPT_circularlog) { // -C |
614 | if (opt_C) { | 614 | if (opt_C) { |
615 | int buf_size = atoi(opt_C); | 615 | shm_size = xatoul_range(opt_C, 4, INT_MAX/1024) * 1024; |
616 | if (buf_size >= 4) | ||
617 | shm_size = buf_size * 1024; | ||
618 | } | 616 | } |
619 | } | 617 | } |
620 | #endif | 618 | #endif |