From 72996b1821b5dbd22f5e08c477660a75a38e4414 Mon Sep 17 00:00:00 2001
From: MIZUTA Takeshi <mizuta.takeshi@fujitsu.com>
Date: Wed, 14 Apr 2021 20:08:17 +0900
Subject: [PATCH 2048/2246] Fix the closing timing of audit_fd (#166)

---
 lib/netlink.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/netlink.c b/lib/netlink.c
index 9525b8d..f7cbeb0 100644
--- a/lib/netlink.c
+++ b/lib/netlink.c
@@ -64,10 +64,10 @@ int audit_open(void)
 	}
 	if (fcntl(fd, F_SETFD, FD_CLOEXEC) == -1) {
 		saved_errno = errno;
-		close(fd);
 		audit_msg(LOG_ERR, 
 			"Error setting audit netlink socket CLOEXEC flag (%s)", 
 			strerror(errno));
+		close(fd);
 		errno = saved_errno;
 		return -1;
 	}
-- 
1.8.3.1

