util.signal: Fail signalfd() if unable to change signal mask
authorKim Alvefur <zash@zash.se>
Wed, 28 Feb 2024 22:31:06 +0100
changeset 13452 93b4ce0115f0
parent 13451 5c9df28a57bb
child 13453 9912baa541c0
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
--- a/util-src/signal.c	Wed Feb 28 22:24:09 2024 +0100
+++ b/util-src/signal.c	Wed Feb 28 22:31:06 2024 +0100
@@ -384,7 +384,10 @@
 	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);