]> the.earth.li Git - onak.git/commitdiff
Error out if there's any problem setting up the keyd socket
authorJonathan McDowell <noodles@earth.li>
Fri, 6 Sep 2019 17:56:51 +0000 (18:56 +0100)
committerJonathan McDowell <noodles@earth.li>
Fri, 6 Sep 2019 17:56:51 +0000 (18:56 +0100)
Rather than ending up in an accept() loop that goes nowhere, print
the error we saw and exit.

keydb/keyd.c

index ddd1366a9bb7c94b56b6d31fc7b181005ae2c663..0df7192bfb6795b35d0d2b85ae8eafb6b699d6d1 100644 (file)
@@ -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
        }