From 6565bed3065d1751abf469da1a85884d9ddde759 Mon Sep 17 00:00:00 2001 From: Jonathan McDowell Date: Fri, 6 Sep 2019 18:56:51 +0100 Subject: [PATCH] Error out if there's any problem setting up the keyd socket Rather than ending up in an accept() loop that goes nowhere, print the error we saw and exit. --- keydb/keyd.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/keydb/keyd.c b/keydb/keyd.c index ddd1366..0df7192 100644 --- a/keydb/keyd.c +++ b/keydb/keyd.c @@ -232,10 +232,15 @@ static int sock_init(const char *sockname) if (ret != -1) { ret = listen(fd, 5); - if (ret == -1) { - close(fd); - fd = -1; - } + } + + if (ret == -1) { + logthing(LOGTHING_ERROR, + "Couldn't open socket to listen on: %s (%d)", + strerror(errno), + errno); + close(fd); + fd = -1; } #ifdef HAVE_SYSTEMD } -- 2.39.5