From: Donald Sharp Date: Wed, 8 Feb 2017 13:26:07 +0000 (-0500) Subject: zebra: Don't leak socket with failure condition X-Git-Tag: frr-3.0-branchpoint~45^2~2 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=95c54276f76cd6b9bc628c2a484d9937813324ed;p=mirror%2Ffrr.git zebra: Don't leak socket with failure condition Don't leak a socket when we are unable to set it as non-blocking and warn the user as appropriate. Signed-off-by: Donald Sharp --- diff --git a/zebra/zebra_ptm.c b/zebra/zebra_ptm.c index 446eb4953b..bc924842d4 100644 --- a/zebra/zebra_ptm.c +++ b/zebra/zebra_ptm.c @@ -388,7 +388,13 @@ zebra_ptm_socket_init (void) if (sock < 0) return -1; if (set_nonblocking(sock) < 0) - return -1; + { + if (IS_ZEBRA_DEBUG_EVENT) + zlog_debug ("%s: Unable to set socket non blocking[%s]", + __PRETTY_FUNCTION__, safe_strerror (errno)); + close (sock); + return -1; + } /* Make server socket. */ memset (&addr, 0, sizeof (struct sockaddr_un));