From a2e4f9a8aa12d33154a6607e94dc6ebafa7f463e Mon Sep 17 00:00:00 2001 From: Vincent Penquerc'h Date: Sat, 28 Dec 2013 11:22:48 -0500 Subject: [PATCH] ioall: do not reset file flags when they're already as requested This was changed on a copy of that file elsewhere, might as well keep this in sync too. --- qrexec-lib/ioall.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/qrexec-lib/ioall.c b/qrexec-lib/ioall.c index ac679a8..ef04e0b 100644 --- a/qrexec-lib/ioall.c +++ b/qrexec-lib/ioall.c @@ -35,12 +35,16 @@ void perror_wrapper(const 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); }