aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2024-02-28 22:24:09 +0100
committerKim Alvefur <zash@zash.se>2024-02-28 22:24:09 +0100
commitf1e07782eddfe9944e40ecca15f362de27a863ad (patch)
tree36ac3dfe5d6e7e366480610bab15c74a0cb48df3 /net
parent3d2bad3d4b367d200c9368f5dc75ddfd46d0b41b (diff)
downloadprosody-f1e07782eddfe9944e40ecca15f362de27a863ad.tar.gz
prosody-f1e07782eddfe9944e40ecca15f362de27a863ad.zip
net.server_epoll: Log failure to hook signals
To make any such failures noticeable
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;