[1/2] discover/ipmi: Open devnode with O_CLOEXEC
diff mbox

Message ID 20170822040414.11485-1-sam@mendozajonas.com
State Accepted
Headers show

Commit Message

Samuel Mendoza-Jonas Aug. 22, 2017, 4:04 a.m. UTC
The IPMI device node is kept open for the life of the platform - include
the O_CLOEXEC flag so it is not kept open for child processes.

Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
---
 discover/ipmi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch
diff mbox

diff --git a/discover/ipmi.c b/discover/ipmi.c
index 2aaf114..d652e9f 100644
--- a/discover/ipmi.c
+++ b/discover/ipmi.c
@@ -201,7 +201,7 @@  struct ipmi *ipmi_open(void *ctx)
 	struct ipmi *ipmi;
 	int fd;
 
-	fd = open(ipmi_devnode, O_RDWR);
+	fd = open(ipmi_devnode, O_RDWR | O_CLOEXEC);
 	if (fd < 0) {
 		pb_log("IPMI: can't open IPMI device %s: %m\n", ipmi_devnode);
 		return NULL;