coredump: parse signal number at the same time as parsing other fields

This commit is contained in:
Lennart Poettering
2024-10-31 23:08:11 +01:00
parent 32756e57ef
commit 960b045875
3 changed files with 40 additions and 31 deletions
+16
View File
@@ -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;
}
+2
View File
@@ -68,3 +68,5 @@ void propagate_signal(int sig, siginfo_t *siginfo);
extern const struct sigaction sigaction_ignore;
extern const struct sigaction sigaction_default;
int parse_signo(const char *s, int *ret);