From 1e72af9c5169c83f537d27c66c3cf3db015fce6b Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 30 May 2007 15:43:25 +1000 Subject: close sockets when we exec scripts (This used to be ctdb commit 0fac2164db4279db2d7d376a34be05b890304087) --- ctdb/common/ctdb_util.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'ctdb/common/ctdb_util.c') diff --git a/ctdb/common/ctdb_util.c b/ctdb/common/ctdb_util.c index d88b809f14..71d11734ef 100644 --- a/ctdb/common/ctdb_util.c +++ b/ctdb/common/ctdb_util.c @@ -217,3 +217,18 @@ void ctdb_set_realtime(void) } #endif } + +void set_nonblocking(int fd) +{ + unsigned v; + v = fcntl(fd, F_GETFL, 0); + fcntl(fd, F_SETFL, v | O_NONBLOCK); +} + +void set_close_on_exec(int fd) +{ + unsigned v; + v = fcntl(fd, F_GETFD, 0); + fcntl(fd, F_SETFD, v | FD_CLOEXEC); +} + -- cgit