diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2007-08-03 10:58:12 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2007-08-03 10:58:12 +0000 |
commit | f223efbcde63c0c01e5b1331f2fc7f1a9c812f20 (patch) | |
tree | dc309c15cc447cd3d815d18e44fefb4534e6316b /runit/svlogd.c | |
parent | 9a3b7b1db736c572ec8c2959daac148369a14cef (diff) | |
download | busybox-w32-f223efbcde63c0c01e5b1331f2fc7f1a9c812f20.tar.gz busybox-w32-f223efbcde63c0c01e5b1331f2fc7f1a9c812f20.tar.bz2 busybox-w32-f223efbcde63c0c01e5b1331f2fc7f1a9c812f20.zip |
svlogd: fix timestamping; do not warn if config is missing
sv: extend help text
Diffstat (limited to '')
-rw-r--r-- | runit/svlogd.c | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/runit/svlogd.c b/runit/svlogd.c index b271b743f..e16043e44 100644 --- a/runit/svlogd.c +++ b/runit/svlogd.c | |||
@@ -465,8 +465,8 @@ static unsigned logdir_open(struct logdir *ld, const char *fn) | |||
465 | 465 | ||
466 | /* read config */ | 466 | /* read config */ |
467 | i = open_read_close("config", buf, sizeof(buf)); | 467 | i = open_read_close("config", buf, sizeof(buf)); |
468 | if (i < 0) | 468 | if (i < 0 && errno != ENOENT) |
469 | warn2("cannot read config", ld->name); | 469 | bb_perror_msg(WARNING": %s/config", ld->name); |
470 | if (i > 0) { | 470 | if (i > 0) { |
471 | if (verbose) bb_error_msg(INFO"read: %s/config", ld->name); | 471 | if (verbose) bb_error_msg(INFO"read: %s/config", ld->name); |
472 | s = buf; | 472 | s = buf; |
@@ -835,19 +835,8 @@ int svlogd_main(int argc, char **argv) | |||
835 | char ch; | 835 | char ch; |
836 | 836 | ||
837 | lineptr = line; | 837 | lineptr = line; |
838 | taia_now(&now); | 838 | if (timestamp) |
839 | /* Prepare timestamp if needed */ | ||
840 | if (timestamp) { | ||
841 | switch (timestamp) { | ||
842 | case 1: | ||
843 | fmt_taia25(stamp, &now); | ||
844 | break; | ||
845 | default: /* case 2: */ | ||
846 | fmt_ptime30nul(stamp, &now); | ||
847 | break; | ||
848 | } | ||
849 | lineptr += 26; | 839 | lineptr += 26; |
850 | } | ||
851 | 840 | ||
852 | /* lineptr[0..linemax-1] - buffer for stdin */ | 841 | /* lineptr[0..linemax-1] - buffer for stdin */ |
853 | /* (possibly has some unprocessed data from prev loop) */ | 842 | /* (possibly has some unprocessed data from prev loop) */ |
@@ -857,6 +846,7 @@ int svlogd_main(int argc, char **argv) | |||
857 | if (!np && !exitasap) { | 846 | if (!np && !exitasap) { |
858 | i = linemax - stdin_cnt; /* avail. bytes at tail */ | 847 | i = linemax - stdin_cnt; /* avail. bytes at tail */ |
859 | if (i >= 128) { | 848 | if (i >= 128) { |
849 | taia_now(&now); | ||
860 | i = buffer_pread(0, lineptr + stdin_cnt, i, &now); | 850 | i = buffer_pread(0, lineptr + stdin_cnt, i, &now); |
861 | if (i <= 0) /* EOF or error on stdin */ | 851 | if (i <= 0) /* EOF or error on stdin */ |
862 | exitasap = 1; | 852 | exitasap = 1; |
@@ -889,6 +879,11 @@ int svlogd_main(int argc, char **argv) | |||
889 | printlen = linelen; | 879 | printlen = linelen; |
890 | printptr = lineptr; | 880 | printptr = lineptr; |
891 | if (timestamp) { | 881 | if (timestamp) { |
882 | taia_now(&now); | ||
883 | if (timestamp == 1) | ||
884 | fmt_taia25(stamp, &now); | ||
885 | else /* 2: */ | ||
886 | fmt_ptime30nul(stamp, &now); | ||
892 | printlen += 26; | 887 | printlen += 26; |
893 | printptr -= 26; | 888 | printptr -= 26; |
894 | memcpy(printptr, stamp, 25); | 889 | memcpy(printptr, stamp, 25); |