diff --git a/qubes-rpc/ioall.c b/qubes-rpc/ioall.c index 2a81df4..ce61700 100644 --- a/qubes-rpc/ioall.c +++ b/qubes-rpc/ioall.c @@ -35,12 +35,16 @@ void perror_wrapper(char * msg) void set_nonblock(int fd) { int fl = fcntl(fd, F_GETFL, 0); + if (fl & O_NONBLOCK) + return; fcntl(fd, F_SETFL, fl | O_NONBLOCK); } void set_block(int fd) { int fl = fcntl(fd, F_GETFL, 0); + if (!(fl & O_NONBLOCK)) + return; fcntl(fd, F_SETFL, fl & ~O_NONBLOCK); }