tree-wide: add new SIGNAL_VALID() macro-like function that validates signal numbers
And port all code over to use it.
This commit is contained in:
@@ -255,7 +255,7 @@ int signal_from_string(const char *s) {
|
||||
}
|
||||
if (safe_atou(s, &u) >= 0) {
|
||||
signo = (int) u + offset;
|
||||
if (signo > 0 && signo < _NSIG)
|
||||
if (SIGNAL_VALID(signo))
|
||||
return signo;
|
||||
}
|
||||
return -EINVAL;
|
||||
|
||||
@@ -50,3 +50,7 @@ static inline void block_signals_reset(sigset_t *ss) {
|
||||
assert_se(sigprocmask_many(SIG_BLOCK, &t, __VA_ARGS__, -1) >= 0); \
|
||||
t; \
|
||||
})
|
||||
|
||||
static inline bool SIGNAL_VALID(int signo) {
|
||||
return signo > 0 && signo < _NSIG;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user