From 6abb1fc25fc21382c511b93d0736d1e9425940db Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Wed, 24 Aug 2016 08:20:38 -0400 Subject: [PATCH] pimd: Fix double close of socket. When a interface bounces fix the double close from happening Signed-off-by: Donald Sharp --- pimd/pim_pim.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/pimd/pim_pim.c b/pimd/pim_pim.c index f58e326d16..4924acea74 100644 --- a/pimd/pim_pim.c +++ b/pimd/pim_pim.c @@ -90,7 +90,10 @@ static void sock_close(struct interface *ifp) pim_ifp->pim_sock_fd, ifp->name); } - if (close(pim_ifp->pim_sock_fd)) { + /* + * If the fd is already deleted no need to do anything here + */ + if (pim_ifp->pim_sock_fd > 0 && close(pim_ifp->pim_sock_fd)) { zlog_warn("Failure closing PIM socket fd=%d on interface %s: errno=%d: %s", pim_ifp->pim_sock_fd, ifp->name, errno, safe_strerror(errno)); @@ -98,11 +101,6 @@ static void sock_close(struct interface *ifp) pim_ifp->pim_sock_fd = -1; pim_ifp->pim_sock_creation = 0; - - zassert(pim_ifp->pim_sock_fd < 0); - zassert(!pim_ifp->t_pim_sock_read); - zassert(!pim_ifp->t_pim_hello_timer); - zassert(!pim_ifp->pim_sock_creation); } void pim_sock_delete(struct interface *ifp, const char *delete_message) -- 2.39.5