diff options
author | Kay Sievers <kay.sievers@suse.de> | 2006-03-16 10:47:31 +0100 |
---|---|---|
committer | Kay Sievers <kay.sievers@suse.de> | 2006-03-16 10:47:31 +0100 |
commit | f660222775b2603c3d4b5a7119a4daffff794b2c (patch) | |
tree | f544bf5729ca51267f2695358d2abebbf3a9d0f6 /udevd.c | |
parent | 3e5e833253a0683935808c90498b6c639be955fe (diff) |
correct use of fcntl()
Diffstat (limited to 'udevd.c')
-rw-r--r-- | udevd.c | 16 |
1 files changed, 14 insertions, 2 deletions
@@ -921,12 +921,24 @@ int main(int argc, char *argv[], char *envp[]) err("error getting pipes: %s", strerror(errno)); goto exit; } - retval = fcntl(signal_pipe[READ_END], F_SETFL, O_NONBLOCK); + + retval = fcntl(signal_pipe[READ_END], F_GETFL, 0); + if (retval < 0) { + err("error fcntl on read pipe: %s", strerror(errno)); + goto exit; + } + retval = fcntl(signal_pipe[READ_END], F_SETFL, retval | O_NONBLOCK); if (retval < 0) { err("error fcntl on read pipe: %s", strerror(errno)); goto exit; } - retval = fcntl(signal_pipe[WRITE_END], F_SETFL, O_NONBLOCK); + + retval = fcntl(signal_pipe[WRITE_END], F_GETFL, 0); + if (retval < 0) { + err("error fcntl on write pipe: %s", strerror(errno)); + goto exit; + } + retval = fcntl(signal_pipe[WRITE_END], F_SETFL, retval | O_NONBLOCK); if (retval < 0) { err("error fcntl on write pipe: %s", strerror(errno)); goto exit; |