Replace g_strsignal() with g_sig2text()

This call provides a textual representation of a signal number, i.e.
SIGHUP is mapped to "SIGHUP"

Unit tests are also added.
This commit is contained in:
matt335672
2023-06-12 15:40:22 +01:00
parent cb9a697fa8
commit ce42e3e12d
6 changed files with 274 additions and 37 deletions
+6 -2
View File
@@ -821,8 +821,12 @@ exit_status_to_str(const struct exit_status *e, char buff[], int bufflen)
break;
case E_XR_SIGNAL:
g_snprintf(buff, bufflen, "signal \"%s\"", g_strsignal(e->val));
break;
{
char sigstr[MAXSTRSIGLEN];
g_snprintf(buff, bufflen, "signal %s",
g_sig2text(e->val, sigstr));
}
break;
default:
g_snprintf(buff, bufflen, "an unexpected error");