#ifdef HAVE_STRINGS_H
# include <strings.h>
#endif /* HAVE_STRINGS_H */
+#include <ctype.h>
#include <signal.h>
#include <unistd.h>
#endif
if (signo > 0 && signo < NSIG && sudo_sys_signame[signo] != NULL) {
strlcpy(signame, sudo_sys_signame[signo], SIG2STR_MAX);
+ /* Make sure we always return an upper case signame. */
+ if (islower((unsigned char)signame[0])) {
+ int i;
+ for (i = 0; signame[i] != '\0'; i++)
+ signame[i] = toupper((unsigned char)signame[i]);
+ }
return 0;
}
errno = EINVAL;
/* Check sys_signame[]. */
for (signo = 1; signo < NSIG; signo++) {
if (sudo_sys_signame[signo] != NULL) {
- if (strcmp(signame, sudo_sys_signame[signo]) == 0) {
+ /* On macOS sys_signame[] may contain lower-case names. */
+ if (strcasecmp(signame, sudo_sys_signame[signo]) == 0) {
*result = signo;
return 0;
}