From 36a958306911d054086b0be3a15b5212a163525d Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Wed, 28 Feb 2024 22:31:06 +0100 Subject: util.signal: Fail signalfd() if unable to change signal mask By aborting early, the failure should be brought to the attention somehow. --- util-src/signal.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'util-src') 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); -- cgit v1.2.3