summaryrefslogtreecommitdiffstats
path: root/innbbsd/closeonexec.c
diff options
context:
space:
mode:
Diffstat (limited to 'innbbsd/closeonexec.c')
-rw-r--r--innbbsd/closeonexec.c32
1 files changed, 1 insertions, 31 deletions
diff --git a/innbbsd/closeonexec.c b/innbbsd/closeonexec.c
index 1fd1a24e..b41fdd69 100644
--- a/innbbsd/closeonexec.c
+++ b/innbbsd/closeonexec.c
@@ -9,9 +9,6 @@
#include <sys/ioctl.h>
#include "clibrary.h"
-#ifndef CLX_IOCTL
-#define CLX_IOCTL
-#endif
#ifndef CLX_FCNTL
#define CLX_FCNTL
#endif
@@ -19,33 +16,6 @@
-#if defined(CLX_IOCTL) && !defined(IRIX)
-#ifdef __linux
-#include <termios.h>
-#else
-#include <sgtty.h>
-#endif
-
-
-/*
- * * Mark a file close-on-exec so that it doesn't get shared with our *
- * children. Ignore any error codes.
- */
-void
-closeOnExec(fd, flag)
- int fd;
- int flag;
-{
- int oerrno;
-
- oerrno = errno;
- (void)ioctl(fd, flag ? FIOCLEX : FIONCLEX, (char *)NULL);
- errno = oerrno;
-}
-#endif /* defined(CLX_IOCTL) */
-
-
-
#if defined(CLX_FCNTL)
#include <fcntl.h>
@@ -63,7 +33,7 @@ CloseOnExec(fd, flag)
int oerrno;
oerrno = errno;
- (void)fcntl(fd, F_SETFD, flag ? 1 : 0);
+ (void)fcntl(fd, F_SETFD, flag ? FD_CLOEXEC : 0);
errno = oerrno;
}
#endif /* defined(CLX_FCNTL) */