From 96e1b38586e80a0f014038bf4fdf4689c668fbd6 Mon Sep 17 00:00:00 2001 From: Denis Vlasenko Date: Sun, 30 Sep 2007 23:50:48 +0000 Subject: introduce and use close_on_exec_on(fd). -50 bytes. --- libbb/xfuncs.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'libbb') diff --git a/libbb/xfuncs.c b/libbb/xfuncs.c index eb1633b..2bf20f3 100644 --- a/libbb/xfuncs.c +++ b/libbb/xfuncs.c @@ -164,6 +164,11 @@ int ndelay_on(int fd) return fcntl(fd, F_SETFL, fcntl(fd,F_GETFL) | O_NONBLOCK); } +int close_on_exec_on(int fd) +{ + return fcntl(fd, F_SETFD, FD_CLOEXEC); +} + int ndelay_off(int fd) { return fcntl(fd, F_SETFL, fcntl(fd,F_GETFL) & ~O_NONBLOCK); -- cgit v1.1