const char *p;
int signo, r;
- /* Check that the input is a signal name. */
- signo = __signal_from_string(s);
- if (signo > 0)
- return signo;
-
+ /* Check that the input is a signal number. */
if (safe_atoi(s, &signo) >= 0) {
if (SIGNAL_VALID(signo))
return signo;
return -ERANGE;
}
+ /* Drop "SIG" prefix. */
+ if (startswith(s, "SIG"))
+ s += 3;
+
+ /* Check that the input is a signal name. */
+ signo = __signal_from_string(s);
+ if (signo > 0)
+ return signo;
+
/* Check that the input is RTMIN or
* RTMIN+n (0 <= n <= SIGRTMAX-SIGRTMIN). */
p = startswith(s, "RTMIN");
return -EINVAL;
}
-int signal_from_string_try_harder(const char *s) {
- int signo;
- assert(s);
-
- signo = signal_from_string(s);
- if (signo <= 0)
- if (startswith(s, "SIG"))
- return signal_from_string(s+3);
-
- return signo;
-}
#if 0 /// UNNEEDED by elogind
void nop_signal_handler(int sig) {