diff options
author | Lennart Poettering <lennart@poettering.net> | 2024-10-31 15:33:44 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2024-10-31 23:08:11 +0100 |
commit | 960b045875b11fd695a862912fd4e48fee4d3dd6 (patch) | |
tree | 236d229898a0257138b1133feeb1875930af2881 /src/basic/signal-util.c | |
parent | coredump: rename save_context() → context_parse_iovw() (diff) | |
download | systemd-960b045875b11fd695a862912fd4e48fee4d3dd6.tar.xz systemd-960b045875b11fd695a862912fd4e48fee4d3dd6.zip |
coredump: parse signal number at the same time as parsing other fields
Diffstat (limited to 'src/basic/signal-util.c')
-rw-r--r-- | src/basic/signal-util.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/basic/signal-util.c b/src/basic/signal-util.c index 670040f1ad..ad9ed049f1 100644 --- a/src/basic/signal-util.c +++ b/src/basic/signal-util.c @@ -301,3 +301,19 @@ const struct sigaction sigaction_default = { .sa_handler = SIG_DFL, .sa_flags = SA_RESTART, }; + +int parse_signo(const char *s, int *ret) { + int sig, r; + + r = safe_atoi(s, &sig); + if (r < 0) + return r; + + if (!SIGNAL_VALID(sig)) + return -EINVAL; + + if (ret) + *ret = sig; + + return 0; +} |