chiark / gitweb /
systemctl: introduce systemctl kill
[elogind.git] / src / util.c
index 58f67b0d15b86b860ca2bb9bbe08ac8d40541b53..cf3cf292a0a6149a817410ee36a4ce2fa87e61e8 100644 (file)
@@ -3339,6 +3339,17 @@ DIR *xopendirat(int fd, const char *name) {
         return fdopendir(openat(fd, name, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC));
 }
 
+int signal_from_string_try_harder(const char *s) {
+        int signo;
+        assert(s);
+
+        if ((signo = signal_from_string(s)) <= 0)
+                if (startswith(s, "SIG"))
+                        return signal_from_string(s+3);
+
+        return signo;
+}
+
 static const char *const ioprio_class_table[] = {
         [IOPRIO_CLASS_NONE] = "none",
         [IOPRIO_CLASS_RT] = "realtime",