summaryrefslogtreecommitdiff
path: root/sysdep/unix
diff options
context:
space:
mode:
authorMaria Matejka <mq@jmq.cz>2021-09-07 16:22:32 +0000
committerMaria Matejka <mq@ucw.cz>2021-10-13 19:00:36 +0200
commit3a31c3aad6c53ea9673743f983e13728d8551149 (patch)
treeb0b5e1ab704e1744d90c195a30ab51c74133ffc6 /sysdep/unix
parentd322ee3d548a87d6e996dd20b2b415aad4b53f62 (diff)
CLI socket accept() may also fail and should produce some message, not a coredump.
Diffstat (limited to 'sysdep/unix')
-rw-r--r--sysdep/unix/main.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/sysdep/unix/main.c b/sysdep/unix/main.c
index 392aff9d..cdf0a310 100644
--- a/sysdep/unix/main.c
+++ b/sysdep/unix/main.c
@@ -479,6 +479,14 @@ cli_err(sock *s, int err)
cli_free(s->data);
}
+static void
+cli_connect_err(sock *s UNUSED, int err)
+{
+ ASSERT_DIE(err);
+ if (config->cli_debug)
+ log(L_INFO "Failed to accept CLI connection: %s", strerror(err));
+}
+
static int
cli_connect(sock *s, uint size UNUSED)
{
@@ -507,6 +515,7 @@ cli_init_unix(uid_t use_uid, gid_t use_gid)
s = cli_sk = sk_new(cli_pool);
s->type = SK_UNIX_PASSIVE;
s->rx_hook = cli_connect;
+ s->err_hook = cli_connect_err;
s->rbsize = 1024;
s->fast_rx = 1;