From f660222775b2603c3d4b5a7119a4daffff794b2c Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 16 Mar 2006 10:47:31 +0100 Subject: [PATCH] correct use of fcntl() --- udevd.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/udevd.c b/udevd.c index 9340be1..701165b 100644 --- a/udevd.c +++ b/udevd.c @@ -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; -- 2.7.4