aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2022-03-19 11:38:21 +0000
committerMatthew Wild <mwild1@gmail.com>2022-03-19 11:38:21 +0000
commitf8690bf1513bc97708dd63e0355669e3f431cf4c (patch)
tree10da6eedda69a08d5960dc13208e4edd563fe254 /plugins
parentafbef6406b00c91db1a79701d61786ba79f810b4 (diff)
downloadprosody-f8690bf1513bc97708dd63e0355669e3f431cf4c.tar.gz
prosody-f8690bf1513bc97708dd63e0355669e3f431cf4c.zip
mod_admin_socket: Improve error reporting when socket can't be created (fixes #1719)
Diffstat (limited to 'plugins')
-rw-r--r--plugins/mod_admin_socket.lua12
1 files changed, 10 insertions, 2 deletions
diff --git a/plugins/mod_admin_socket.lua b/plugins/mod_admin_socket.lua
index ffea9c61..c4e1d260 100644
--- a/plugins/mod_admin_socket.lua
+++ b/plugins/mod_admin_socket.lua
@@ -62,8 +62,16 @@ function module.load()
sock = unix.stream();
sock:settimeout(0);
os.remove(socket_path);
- assert(sock:bind(socket_path));
- assert(sock:listen());
+ local ok, err = sock:bind(socket_path);
+ if not ok then
+ module:log_status("error", "Unable to bind admin socket %s: %s", socket_path, err);
+ return;
+ end
+ local ok, err = sock:listen();
+ if not ok then
+ module:log_status("error", "Unable to listen on admin socket %s: %s", socket_path, err);
+ return;
+ end
if server.wrapserver then
conn = server.wrapserver(sock, socket_path, 0, listeners);
else