]> git.ozlabs.org Git - petitboot/commitdiff
discover/ipmi: Open devnode with O_CLOEXEC
authorSamuel Mendoza-Jonas <sam@mendozajonas.com>
Tue, 22 Aug 2017 01:36:06 +0000 (11:36 +1000)
committerSamuel Mendoza-Jonas <sam@mendozajonas.com>
Tue, 22 Aug 2017 05:06:45 +0000 (15:06 +1000)
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

index 2aaf114c20c5bb248141d01b0c786ff26dcd402e..d652e9fbb966187384ea890780bf870bc8797a3b 100644 (file)
@@ -201,7 +201,7 @@ struct ipmi *ipmi_open(void *ctx)
        struct ipmi *ipmi;
        int fd;
 
        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;
        if (fd < 0) {
                pb_log("IPMI: can't open IPMI device %s: %m\n", ipmi_devnode);
                return NULL;