summaryrefslogtreecommitdiffstats
path: root/ctdb/common/ctdb_util.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2007-05-30 15:43:25 +1000
committerAndrew Tridgell <tridge@samba.org>2007-05-30 15:43:25 +1000
commit1e72af9c5169c83f537d27c66c3cf3db015fce6b (patch)
treefa4ec47608b1497ad3a9767ac0a59b42d4b49fc8 /ctdb/common/ctdb_util.c
parentc833b06a35afd2de5edc237df0b1a461a649d9e3 (diff)
downloadsamba-1e72af9c5169c83f537d27c66c3cf3db015fce6b.tar.gz
samba-1e72af9c5169c83f537d27c66c3cf3db015fce6b.tar.xz
samba-1e72af9c5169c83f537d27c66c3cf3db015fce6b.zip
close sockets when we exec scripts
(This used to be ctdb commit 0fac2164db4279db2d7d376a34be05b890304087)
Diffstat (limited to 'ctdb/common/ctdb_util.c')
-rw-r--r--ctdb/common/ctdb_util.c15
1 files changed, 15 insertions, 0 deletions
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);
+}
+