summaryrefslogtreecommitdiff
path: root/source4/heimdal/lib/roken/cloexec.c
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2010-01-12 18:16:45 +1100
committerAndrew Bartlett <abartlet@samba.org>2010-03-27 11:51:27 +1100
commit89eaef025376339ef25d07cdc4748920fceaa968 (patch)
treef514f4632c9d54a372a7f1f0ca845a0c3a488fbf /source4/heimdal/lib/roken/cloexec.c
parentfac8ca52ade6e490eea3cf3d0fc98287da321c13 (diff)
downloadsamba-89eaef025376339ef25d07cdc4748920fceaa968.tar.gz
samba-89eaef025376339ef25d07cdc4748920fceaa968.tar.bz2
samba-89eaef025376339ef25d07cdc4748920fceaa968.zip
s4:heimdal: import lorikeet-heimdal-201001120029 (commit a5e675fed7c5db8a7370b77ed0bfa724196aa84d)
Diffstat (limited to 'source4/heimdal/lib/roken/cloexec.c')
-rw-r--r--source4/heimdal/lib/roken/cloexec.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/source4/heimdal/lib/roken/cloexec.c b/source4/heimdal/lib/roken/cloexec.c
index c015b1d8fa..2d1fe033f2 100644
--- a/source4/heimdal/lib/roken/cloexec.c
+++ b/source4/heimdal/lib/roken/cloexec.c
@@ -33,14 +33,12 @@
#include <config.h>
-#include <unistd.h>
-#include <fcntl.h>
-
#include "roken.h"
void ROKEN_LIB_FUNCTION
rk_cloexec(int fd)
{
+#ifdef HAVE_FCNTL
int ret;
ret = fcntl(fd, F_GETFD);
@@ -48,10 +46,21 @@ rk_cloexec(int fd)
return;
if (fcntl(fd, F_SETFD, ret | FD_CLOEXEC) == -1)
return;
+#endif
}
void ROKEN_LIB_FUNCTION
rk_cloexec_file(FILE *f)
{
+#ifdef HAVE_FCNTL
rk_cloexec(fileno(f));
+#endif
+}
+
+void ROKEN_LIB_FUNCTION
+rk_cloexec_dir(DIR * d)
+{
+#ifndef _WIN32
+ rk_cloexec(dirfd(d));
+#endif
}