diff options
Diffstat (limited to 'src/shared')
-rw-r--r-- | src/shared/exit-status.c | 14 | ||||
-rw-r--r-- | src/shared/exit-status.h | 1 |
2 files changed, 15 insertions, 0 deletions
diff --git a/src/shared/exit-status.c b/src/shared/exit-status.c index 9e14eb8bf5..c09efdd2cb 100644 --- a/src/shared/exit-status.c +++ b/src/shared/exit-status.c @@ -225,3 +225,17 @@ bool exit_status_set_is_empty(ExitStatusSet *x) { return set_isempty(x->status) && set_isempty(x->signal); } + +bool exit_status_set_test(ExitStatusSet *x, int code, int status) { + + if (exit_status_set_is_empty(x)) + return false; + + if (code == CLD_EXITED && set_contains(x->status, INT_TO_PTR(status))) + return true; + + if (IN_SET(code, CLD_KILLED, CLD_DUMPED) && set_contains(x->signal, INT_TO_PTR(status))) + return true; + + return false; +} diff --git a/src/shared/exit-status.h b/src/shared/exit-status.h index 1d774f25dc..7259cd1d18 100644 --- a/src/shared/exit-status.h +++ b/src/shared/exit-status.h @@ -100,3 +100,4 @@ bool is_clean_exit_lsb(int code, int status, ExitStatusSet *success_status); void exit_status_set_free(ExitStatusSet *x); bool exit_status_set_is_empty(ExitStatusSet *x); +bool exit_status_set_test(ExitStatusSet *x, int code, int status); |