diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2004-12-18 22:35:42 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2004-12-18 22:35:42 +0000 |
commit | b277f4142edf5132e56ad2e197b0cd4ec79fa9b6 (patch) | |
tree | b6e849575bcc6a4510f877a15632133562f71ff8 /bin | |
parent | db410d16f492f3893149595dc39abcb580283f6e (diff) |
Replace fd_clexec() with calls to fcntl(fd, F_SETFD, FD_CLOEXEC)
Diffstat (limited to 'bin')
-rw-r--r-- | bin/ksh/c_sh.c | 4 | ||||
-rw-r--r-- | bin/ksh/exec.c | 13 | ||||
-rw-r--r-- | bin/ksh/io.c | 4 | ||||
-rw-r--r-- | bin/ksh/proto.h | 3 | ||||
-rw-r--r-- | bin/ksh/shf.c | 6 | ||||
-rw-r--r-- | bin/ksh/tty.c | 4 |
6 files changed, 11 insertions, 23 deletions
diff --git a/bin/ksh/c_sh.c b/bin/ksh/c_sh.c index 32241d69b4d..331f8f38f3c 100644 --- a/bin/ksh/c_sh.c +++ b/bin/ksh/c_sh.c @@ -1,4 +1,4 @@ -/* $OpenBSD: c_sh.c,v 1.20 2004/12/18 21:25:44 millert Exp $ */ +/* $OpenBSD: c_sh.c,v 1.21 2004/12/18 22:35:41 millert Exp $ */ /* * built-in Bourne commands @@ -835,7 +835,7 @@ c_exec(wp) * keeps them open). */ if (!Flag(FSH) && i > 2 && e->savefd[i]) - fd_clexec(i); + fcntl(i, F_SETFD, FD_CLOEXEC); } e->savefd = NULL; } diff --git a/bin/ksh/exec.c b/bin/ksh/exec.c index c329f388b34..c23f0c8718b 100644 --- a/bin/ksh/exec.c +++ b/bin/ksh/exec.c @@ -1,4 +1,4 @@ -/* $OpenBSD: exec.c,v 1.34 2004/12/18 21:25:44 millert Exp $ */ +/* $OpenBSD: exec.c,v 1.35 2004/12/18 22:35:41 millert Exp $ */ /* * execute command tree @@ -28,17 +28,6 @@ static void dbteste_error(Test_env *te, int offset, const char *msg); /* - * we now use this function always. - */ -int -fd_clexec(fd) - int fd; -{ - return fcntl(fd, F_SETFD, 1); -} - - -/* * execute command tree */ int diff --git a/bin/ksh/io.c b/bin/ksh/io.c index f57a49a5b49..4ba9d638718 100644 --- a/bin/ksh/io.c +++ b/bin/ksh/io.c @@ -1,4 +1,4 @@ -/* $OpenBSD: io.c,v 1.16 2004/12/18 21:25:44 millert Exp $ */ +/* $OpenBSD: io.c,v 1.17 2004/12/18 22:35:41 millert Exp $ */ /* * shell buffered IO and formatted output @@ -259,7 +259,7 @@ savefd(fd, noclose) close(fd); } else nfd = fd; - fd_clexec(nfd); + fcntl(nfd, F_SETFD, FD_CLOEXEC); return nfd; } diff --git a/bin/ksh/proto.h b/bin/ksh/proto.h index bf7fa8c20f6..d03762ef082 100644 --- a/bin/ksh/proto.h +++ b/bin/ksh/proto.h @@ -1,4 +1,4 @@ -/* $OpenBSD: proto.h,v 1.17 2004/12/18 21:58:39 millert Exp $ */ +/* $OpenBSD: proto.h,v 1.18 2004/12/18 22:35:41 millert Exp $ */ /* * prototypes for PD-KSH @@ -65,7 +65,6 @@ char *debunk(char *dp, const char *sp, size_t dlen); void expand(char *cp, XPtrV *wp, int f); int glob_str(char *cp, XPtrV *wp, int markdirs); /* exec.c */ -int fd_clexec(int fd); int execute(struct op * volatile t, volatile int flags); int shcomexec(char **wp); struct tbl * findfunc(const char *name, unsigned int h, int create); diff --git a/bin/ksh/shf.c b/bin/ksh/shf.c index 2faebbc25b9..335e55fb65d 100644 --- a/bin/ksh/shf.c +++ b/bin/ksh/shf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: shf.c,v 1.9 2004/12/18 20:55:52 millert Exp $ */ +/* $OpenBSD: shf.c,v 1.10 2004/12/18 22:35:41 millert Exp $ */ /* * Shell file I/O routines @@ -118,7 +118,7 @@ shf_fdopen(fd, sflags, shf) shf->errno_ = 0; shf->bsize = bsize; if (sflags & SHF_CLEXEC) - fd_clexec(fd); + fcntl(fd, F_SETFD, FD_CLOEXEC); return shf; } @@ -161,7 +161,7 @@ shf_reopen(fd, sflags, shf) shf->flags = (shf->flags & (SHF_ALLOCS | SHF_ALLOCB)) | sflags; shf->errno_ = 0; if (sflags & SHF_CLEXEC) - fd_clexec(fd); + fcntl(fd, F_SETFD, FD_CLOEXEC); return shf; } diff --git a/bin/ksh/tty.c b/bin/ksh/tty.c index c71f464da23..e197eaffadb 100644 --- a/bin/ksh/tty.c +++ b/bin/ksh/tty.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tty.c,v 1.4 2004/12/18 22:12:23 millert Exp $ */ +/* $OpenBSD: tty.c,v 1.5 2004/12/18 22:35:41 millert Exp $ */ #include "sh.h" #include <sys/stat.h> @@ -46,7 +46,7 @@ tty_init(init_ttystate) if ((tty_fd = fcntl(tfd, F_DUPFD, FDBASE)) < 0) { warningf(FALSE, "j_ttyinit: dup of tty fd failed: %s", strerror(errno)); - } else if (fd_clexec(tty_fd) < 0) { + } else if (fcntl(tty_fd, F_SETFD, FD_CLOEXEC) < 0) { warningf(FALSE, "j_ttyinit: can't set close-on-exec flag: %s", strerror(errno)); close(tty_fd); |