aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2024-02-28 22:31:06 +0100
committerKim Alvefur <zash@zash.se>2024-02-28 22:31:06 +0100
commit36a958306911d054086b0be3a15b5212a163525d (patch)
tree01613ee31df4beb8fb8367545f227289e54cd49b
parentf1e07782eddfe9944e40ecca15f362de27a863ad (diff)
downloadprosody-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.c5
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);