diff options
author | Gerrit Pape <pape@smarden.org> | 2014-08-01 08:34:38 +0000 |
---|---|---|
committer | Gerrit Pape <pape@smarden.org> | 2014-08-10 16:57:14 +0000 |
commit | 5fe1bc773c2d979093fe4b1f3ecbbed5e6acdaf0 (patch) | |
tree | 318ae525fd45a346fb31f0caefc62a7a2cfc0390 | |
parent | 8edcee63f90bb0cfa7aff2e47a1b0521eab8e735 (diff) | |
download | runit-5fe1bc773c2d979093fe4b1f3ecbbed5e6acdaf0.tar.gz runit-5fe1bc773c2d979093fe4b1f3ecbbed5e6acdaf0.tar.xz runit-5fe1bc773c2d979093fe4b1f3ecbbed5e6acdaf0.zip |
* sv.c: properly format status command's output on failure cases.
-rw-r--r-- | package/CHANGES | 1 | ||||
-rw-r--r-- | src/sv.c | 20 | ||||
-rw-r--r-- | src/sv.dist | 2 |
3 files changed, 14 insertions, 9 deletions
diff --git a/package/CHANGES b/package/CHANGES index 7375039..0431481 100644 --- a/package/CHANGES +++ b/package/CHANGES @@ -1,5 +1,6 @@ 2.1.2 + * sv.c: properly format status command's output on failure cases. * sv.c: support optional LSB init script actions reload and try-restart. * man/sv.8: "sv exit" does not send a TERM signal to the log service diff --git a/src/sv.c b/src/sv.c index 7d3ba19..9003142 100644 --- a/src/sv.c +++ b/src/sv.c @@ -41,6 +41,7 @@ unsigned int lsb; unsigned int verbose =0; unsigned long wait =7; unsigned int kll =0; +unsigned int islog =0; struct taia tstart, tnow, tdiff; struct tai tstatus; @@ -67,6 +68,7 @@ void fatal2(char *m1, char *m2) { void out(char *p, char *m1) { buffer_puts(buffer_1, p); buffer_puts(buffer_1, *service); + if (islog) buffer_puts(buffer_1, "/log"); buffer_puts(buffer_1, ": "); buffer_puts(buffer_1, m1); if (errno) { @@ -155,18 +157,20 @@ int status(char *unused) { rc =svstatus_get(); switch(rc) { case -1: if (lsb) done(4); case 0: return(0); } rc =svstatus_print(*service); + islog =1; if (chdir("log") == -1) { if (errno != error_noent) { - outs("; log: "); outs(WARN); - outs("unable to change to log service directory: "); - outs(error_str(errno)); + outs("; "); + warn("unable to change directory"); } + else outs("\n"); } - else - if (svstatus_get()) { - outs("; "); svstatus_print("log"); - } - flush("\n"); + else { + outs("; "); + if (svstatus_get()) { rc =svstatus_print("log"); outs("\n"); } + } + islog =0; + flush(""); if (lsb) switch(rc) { case 1: done(0); case 2: done(3); case 0: done(4); } return(rc); } diff --git a/src/sv.dist b/src/sv.dist index 7a2be45..5b6c3ee 100644 --- a/src/sv.dist +++ b/src/sv.dist @@ -1,7 +1,7 @@ usage: sv [-v] [-w sec] command service ... 100 -$Id: 7d3ba19cde56692911cf4b2d711774583b1b860f $ +$Id: 900314260c6d52c986c5357673bea2f3bd3f4698 $ usage: sv [-v] [-w sec] command service ... 100 |