mirror of
https://github.com/troglobit/finit.git
synced 2026-10-28 12:30:44 +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
+2
-8
@@ -304,13 +304,10 @@ int strtobytes(char *arg)
|
||||
|
||||
char *sig2str(int signo)
|
||||
{
|
||||
static char signame[8];
|
||||
|
||||
if (signo < 1 || signo >= (int)NELEMS(signames))
|
||||
return "";
|
||||
|
||||
snprintf(signame, sizeof(signame), "/%s", signames[signo]);
|
||||
return signame;
|
||||
return signames[signo];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -337,13 +334,10 @@ int str2sig(char *sig)
|
||||
|
||||
char *code2str(int code)
|
||||
{
|
||||
static char codename[20];
|
||||
|
||||
if (code < 0 || code >= (int)NELEMS(exitcodes))
|
||||
return "";
|
||||
|
||||
snprintf(codename, sizeof(codename), "/%s", exitcodes[code]);
|
||||
return codename;
|
||||
return exitcodes[code];
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user