summaryrefslogtreecommitdiffstats
path: root/common.c
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2008-06-10 22:23:57 +0000
committerRoy Marples <roy@marples.name>2008-06-10 22:23:57 +0000
commiteb942e0abce48272767404ca604573d3ea674302 (patch)
tree479c4d8049b34bb3758034ca0bd2354dce079ce3 /common.c
parent7349c9bf8cf950dfb92d53f9a860f34b33d97229 (diff)
downloaddhcpcd-eb942e0abce48272767404ca604573d3ea674302.tar.xz
Remove the signal array stack as our pipe handling should be secure enough now. Also, move the normalize close_on_exec and setting non block.
Diffstat (limited to 'common.c')
-rw-r--r--common.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/common.c b/common.c
index 7eeb1d9d..5754d40f 100644
--- a/common.c
+++ b/common.c
@@ -171,7 +171,7 @@ fd_hasdata(int fd)
}
int
-close_on_exec(int fd)
+set_cloexec(int fd)
{
int flags;
@@ -184,6 +184,20 @@ close_on_exec(int fd)
return 0;
}
+int
+set_nonblock(int fd)
+{
+ int flags;
+
+ if ((flags = fcntl(fd, F_GETFL, 0)) == -1
+ || fcntl(fd, F_SETFL, flags | O_NONBLOCK) == -1)
+ {
+ logger(LOG_ERR, "fcntl: %s", strerror(errno));
+ return -1;
+ }
+ return 0;
+}
+
/* Handy function to get the time.
* We only care about time advancements, not the actual time itself
* Which is why we use CLOCK_MONOTONIC, but it is not available on all