diff options
| author | Roy Marples <roy@marples.name> | 2008-06-10 22:23:57 +0000 |
|---|---|---|
| committer | Roy Marples <roy@marples.name> | 2008-06-10 22:23:57 +0000 |
| commit | eb942e0abce48272767404ca604573d3ea674302 (patch) | |
| tree | 479c4d8049b34bb3758034ca0bd2354dce079ce3 /common.c | |
| parent | 7349c9bf8cf950dfb92d53f9a860f34b33d97229 (diff) | |
| download | dhcpcd-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.c | 16 |
1 files changed, 15 insertions, 1 deletions
@@ -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 |
