summaryrefslogtreecommitdiff
path: root/runit/svlogd.c
diff options
context:
space:
mode:
authorDenis Vlasenko2007-08-03 10:58:12 +0000
committerDenis Vlasenko2007-08-03 10:58:12 +0000
commitf223efbcde63c0c01e5b1331f2fc7f1a9c812f20 (patch)
treedc309c15cc447cd3d815d18e44fefb4534e6316b /runit/svlogd.c
parent9a3b7b1db736c572ec8c2959daac148369a14cef (diff)
downloadbusybox-f223efbcde63c0c01e5b1331f2fc7f1a9c812f20.zip
busybox-f223efbcde63c0c01e5b1331f2fc7f1a9c812f20.tar.gz
svlogd: fix timestamping; do not warn if config is missing
sv: extend help text
Diffstat (limited to 'runit/svlogd.c')
-rw-r--r--runit/svlogd.c23
1 files changed, 9 insertions, 14 deletions
diff --git a/runit/svlogd.c b/runit/svlogd.c
index b271b74..e16043e 100644
--- a/runit/svlogd.c
+++ b/runit/svlogd.c
@@ -465,8 +465,8 @@ static unsigned logdir_open(struct logdir *ld, const char *fn)
/* read config */
i = open_read_close("config", buf, sizeof(buf));
- if (i < 0)
- warn2("cannot read config", ld->name);
+ if (i < 0 && errno != ENOENT)
+ bb_perror_msg(WARNING": %s/config", ld->name);
if (i > 0) {
if (verbose) bb_error_msg(INFO"read: %s/config", ld->name);
s = buf;
@@ -835,19 +835,8 @@ int svlogd_main(int argc, char **argv)
char ch;
lineptr = line;
- taia_now(&now);
- /* Prepare timestamp if needed */
- if (timestamp) {
- switch (timestamp) {
- case 1:
- fmt_taia25(stamp, &now);
- break;
- default: /* case 2: */
- fmt_ptime30nul(stamp, &now);
- break;
- }
+ if (timestamp)
lineptr += 26;
- }
/* lineptr[0..linemax-1] - buffer for stdin */
/* (possibly has some unprocessed data from prev loop) */
@@ -857,6 +846,7 @@ int svlogd_main(int argc, char **argv)
if (!np && !exitasap) {
i = linemax - stdin_cnt; /* avail. bytes at tail */
if (i >= 128) {
+ taia_now(&now);
i = buffer_pread(0, lineptr + stdin_cnt, i, &now);
if (i <= 0) /* EOF or error on stdin */
exitasap = 1;
@@ -889,6 +879,11 @@ int svlogd_main(int argc, char **argv)
printlen = linelen;
printptr = lineptr;
if (timestamp) {
+ taia_now(&now);
+ if (timestamp == 1)
+ fmt_taia25(stamp, &now);
+ else /* 2: */
+ fmt_ptime30nul(stamp, &now);
printlen += 26;
printptr -= 26;
memcpy(printptr, stamp, 25);