summaryrefslogtreecommitdiff
path: root/util/ipmimv.c
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhosting.net>2016-05-08 23:32:28 +0200
committerJörg Frings-Fürst <debian@jff-webhosting.net>2016-05-08 23:32:28 +0200
commit55adddbc16f65732b57ab8585c47001fced91d77 (patch)
tree27e8239d48c8a6b353db356aff92ee4d225c0a0e /util/ipmimv.c
parentd3c90cdcdf56146af89056ed36bfcc7b4d4956c5 (diff)
Imported Upstream version 2.9.9upstream/2.9.9
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);
}