diff options
author | Kim Alvefur <zash@zash.se> | 2024-02-28 22:31:06 +0100 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2024-02-28 22:31:06 +0100 |
commit | 36a958306911d054086b0be3a15b5212a163525d (patch) | |
tree | 01613ee31df4beb8fb8367545f227289e54cd49b | |
parent | f1e07782eddfe9944e40ecca15f362de27a863ad (diff) | |
download | prosody-36a958306911d054086b0be3a15b5212a163525d.tar.gz prosody-36a958306911d054086b0be3a15b5212a163525d.zip |
util.signal: Fail signalfd() if unable to change signal mask
By aborting early, the failure should be brought to the attention
somehow.
-rw-r--r-- | util-src/signal.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/util-src/signal.c b/util-src/signal.c index ef35067b..76d25d6f 100644 --- a/util-src/signal.c +++ b/util-src/signal.c @@ -384,7 +384,10 @@ static int l_signalfd(lua_State *L) { sigemptyset(&sfd->mask); sigaddset(&sfd->mask, luaL_checkinteger(L, 1)); - sigprocmask(SIG_BLOCK, &sfd->mask, NULL); /* TODO check err */ + if (sigprocmask(SIG_BLOCK, &sfd->mask, NULL) != 0) { + lua_pushnil(L); + return 1; + }; sfd->fd = signalfd(-1, &sfd->mask, SFD_NONBLOCK); |