fcoe-utils/fcoe-utils-1.0.18-fcoemon-Fix-2-file-descriptor-leaks.patch

43 lines
1.3 KiB
Diff
Raw Normal View History

From adbae9962146896a90546ef2cd61abc938c7c2f7 Mon Sep 17 00:00:00 2001
From: Mark Rustad <mark.d.rustad@intel.com>
Date: Fri, 8 Apr 2011 00:24:04 +0000
Subject: [PATCH 15/16] fcoemon: Fix 2 file descriptor leaks
Fix 2 file descriptor leaks, one of which can occur repeatedly.
Signed-off-by: Mark Rustad <mark.d.rustad@intel.com>
Tested-by: Ross Brattain <ross.b.brattain@intel.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: Petr Sabata <psabata@redhat.com>
---
fcoemon.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/fcoemon.c b/fcoemon.c
index 5449ae6..f2f3b86 100644
--- a/fcoemon.c
+++ b/fcoemon.c
@@ -472,6 +472,7 @@ static int fcm_link_init(void)
rc = bind(fd, (struct sockaddr *)&l_local, sizeof(l_local));
if (rc == -1) {
FCM_LOG_ERR(errno, "bind error");
+ close(fd);
return rc;
}
fcm_link_socket = fd;
@@ -1255,8 +1256,10 @@ static void fcm_dcbd_retry_timeout(void *arg)
static void fcm_dcbd_disconnect(void)
{
if (fcm_clif != NULL && fcm_clif->cl_local.sun_path[0] != '\0') {
- if (fcm_clif->cl_fd >= 0)
+ if (fcm_clif->cl_fd >= 0) {
sa_select_rem_fd(fcm_clif->cl_fd);
+ close(fcm_clif->cl_fd);
+ }
unlink(fcm_clif->cl_local.sun_path);
fcm_clif->cl_local.sun_path[0] = '\0';
fcm_clif->cl_fd = -1; /* mark as disconnected */
--
1.7.4.4