aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
Diffstat (limited to 'net')
-rw-r--r--net/server_epoll.lua7
1 files changed, 6 insertions, 1 deletions
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;