]> arthur.barton.de Git - netatalk.git/commitdiff
cnid_metad: fix tsockfd_create() return value on error
authorJustin Maggard <jmaggard10@gmail.com>
Mon, 10 Nov 2014 23:28:17 +0000 (15:28 -0800)
committerRalph Boehme <slow@samba.org>
Tue, 11 Nov 2014 09:43:28 +0000 (10:43 +0100)
We ran into a case where the netatalk log grew at an extremely rapid
pace.  There was one message that kept repeating:

cnid_metad[2528] {usockfd.c:169} (E:CNID): error in accept: Socket
operation on non-socket

An strace showed pselect() getting called on stdin, rather than an
actual socket.  Looking at the code, I see that tsockfd_create() will
return 0 instead of -1 if the call to getaddrinfo() fails, which is
obviously wrong.

Reviewed-by: Ralph Boehme <slow@samba.org>
NEWS
etc/cnid_dbd/usockfd.c

diff --git a/NEWS b/NEWS
index 813277b77a28cc32cbf41895266d6cd11a1c073a..999468c84a40a59578edab784dc26c6de6e14d6c 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -13,6 +13,7 @@ Changes in 3.1.7
        escalation in afpd processes
 * FIX: afpd: ACL related error messages, now logged with loglevel
        debug instead of error
+* FIX: cnid_metad: fix tsockfd_create() return value on error
 
 Changes in 3.1.6
 ================
index f5cdea4d22fa7c7ecd80e3ff1461f0d9dfa4c8f1..269c6575beefbc8e5f5026d6d090425892a40d62 100644 (file)
@@ -86,7 +86,7 @@ int tsockfd_create(char *host, char *port, int backlog)
 
     if ((ret = getaddrinfo(host, port, &hints, &servinfo)) != 0) {
         LOG(log_error, logtype_cnid, "tsockfd_create: getaddrinfo: %s\n", gai_strerror(ret));
-        return 0;
+        return -1;
     }
 
     /* create a socket */