From f1e07782eddfe9944e40ecca15f362de27a863ad Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Wed, 28 Feb 2024 22:24:09 +0100 Subject: net.server_epoll: Log failure to hook signals To make any such failures noticeable --- net/server_epoll.lua | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/net/server_epoll.lua b/net/server_epoll.lua index 127d049e..98a9f306 100644 --- a/net/server_epoll.lua +++ b/net/server_epoll.lua @@ -1151,7 +1151,12 @@ if have_signal and signal.signalfd then end function hook_signal(signum, cb) - local watch = watchfd(signal.signalfd(signum), dispatch); + local sigfd = signal.signalfd(signum); + if not sigfd then + log("error", "Could not hook signal %d", signum); + return nil, "failed"; + end + local watch = watchfd(sigfd, dispatch); watch.listeners = { onsignal = cb }; watch.close = nil; -- revert to default return watch; -- cgit v1.2.3