mirror of
https://github.com/troglobit/finit.git
synced 2026-10-23 11:44:37 +00:00
Drop confusing leading / in sig2str() and code2str()
This was added for the benefit of `initctl status foo`, but we have other users of these functions that don't expect a leading slash. Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
1 parent
4709394ae6
commit
bd5cf7c9eb
2 files changed
+12
-12
No files matched your search
+10
-4
@@ -738,15 +738,21 @@ static char *svc_environ(svc_t *svc, char *buf, size_t len)
|
||||
static char *exit_status(svc_t *svc, char *buf, size_t len)
|
||||
{
|
||||
int rc, sig;
|
||||
char *str;
|
||||
|
||||
rc = WEXITSTATUS(svc->status);
|
||||
sig = WTERMSIG(svc->status);
|
||||
|
||||
if (WIFEXITED(svc->status))
|
||||
snprintf(buf, len, " (code=exited, status=%d%s%s)", rc, code2str(rc),
|
||||
if (WIFEXITED(svc->status)) {
|
||||
str = code2str(rc);
|
||||
snprintf(buf, len, " (code=exited, status=%d%s%s%s)", rc,
|
||||
str[0] ? "/" : "", str,
|
||||
svc->manual ? ", manual=yes" : "");
|
||||
else if (WIFSIGNALED(svc->status))
|
||||
snprintf(buf, len, " (code=signal, status=%d%s)", sig, sig2str(sig));
|
||||
}
|
||||
else if (WIFSIGNALED(svc->status)) {
|
||||
str = sig2str(sig);
|
||||
snprintf(buf, len, " (code=signal, status=%d%s%s)", sig, str[0] ? "/" : "", str);
|
||||
}
|
||||
|
||||
return buf;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user