Changeset

13448:93b4ce0115f0

util.signal: Fail signalfd() if unable to change signal mask By aborting early, the failure should be brought to the attention somehow.
author Kim Alvefur <zash@zash.se>
date Wed, 28 Feb 2024 22:31:06 +0100
parents 13447:5c9df28a57bb
children 13449:9912baa541c0
files util-src/signal.c
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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);