summaryrefslogtreecommitdiff
path: root/util/ipmimv.c
diff options
context:
space:
mode:
Diffstat (limited to 'util/ipmimv.c')
-rw-r--r--util/ipmimv.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/util/ipmimv.c b/util/ipmimv.c
index accda41..8962ef5 100644
--- a/util/ipmimv.c
+++ b/util/ipmimv.c
@@ -241,6 +241,23 @@ static void dbgmsg(char *pattn, ...)
fflush( fpdbg );
}
+int set_cloexec(fd,fdebugcmd)
+{
+ int flags;
+ flags = fcntl(ipmi_fd, F_GETFD);
+ if (flags == -1) {
+ if (fdebugcmd) printf("fcntl(get) errno = %d\n",errno);
+ return -1;
+ }
+ flags |= FD_CLOEXEC;
+ if (fcntl(ipmi_fd, F_SETFD, flags) == -1)
+ {
+ if (fdebugcmd) printf("fcntl(set) errno = %d\n",errno);
+ return -1;
+ }
+ return 0;
+}
+
int ipmi_open_mv(char fdebugcmd)
{
char *pdev;
@@ -285,6 +302,7 @@ int ipmi_open_mv(char fdebugcmd)
}
}
+ set_cloexec(ipmi_fd,fdebugcmd);
if (fdebugcmd) {
dbgmsg("ipmi_open_mv: successfully opened %s, fd=%d\n",pdev,ipmi_fd);
}