summaryrefslogtreecommitdiff
path: root/lib/network.c
diff options
context:
space:
mode:
authorQuentin Young <qlyoung@cumulusnetworks.com>2016-11-12 05:17:37 +0000
committerQuentin Young <qlyoung@cumulusnetworks.com>2016-11-12 05:17:37 +0000
commit07321a065d1126c00766ca3d6698e57936699f82 (patch)
treea7dac2bb2248d87f40b1c3c2af7440d9bea35421 /lib/network.c
parent17aca20bfbb9d7e980a04c9b017f87f027901839 (diff)
parent11ec76edb225c0f0e6a57b1d667179b14aa2ac20 (diff)
Merge branch 'cmaster-next' into vtysh-grammar
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com> Conflicts: lib/command.c lib/vty.c
Diffstat (limited to 'lib/network.c')
-rw-r--r--lib/network.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/network.c b/lib/network.c
index 5379ecb5a6..506e019136 100644
--- a/lib/network.c
+++ b/lib/network.c
@@ -94,6 +94,20 @@ set_nonblocking(int fd)
return 0;
}
+int
+set_cloexec(int fd)
+{
+ int flags;
+ flags = fcntl(fd, F_GETFD, 0);
+ if (flags == -1)
+ return -1;
+
+ flags |= FD_CLOEXEC;
+ if (fcntl(fd, F_SETFD, flags) == -1)
+ return -1;
+ return 0;
+}
+
float
htonf (float host)
{