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:
Joachim Wiberg committed 2022-11-08 22:37:13 +01:00
1 parent 4709394ae6
commit bd5cf7c9eb
2 files changed
+12 -12

No files matched your search

+2 -8
View File
@@ -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];
}