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.
This commit is contained in:
Vincent Penquerc'h 2013-12-28 11:22:48 -05:00 committed by Marek Marczykowski-Górecki
parent 3a39c65e3e
commit a2e4f9a8aa

View File

@ -35,12 +35,16 @@ void perror_wrapper(const char * msg)
void set_nonblock(int fd) void set_nonblock(int fd)
{ {
int fl = fcntl(fd, F_GETFL, 0); int fl = fcntl(fd, F_GETFL, 0);
if (fl & O_NONBLOCK)
return;
fcntl(fd, F_SETFL, fl | O_NONBLOCK); fcntl(fd, F_SETFL, fl | O_NONBLOCK);
} }
void set_block(int fd) void set_block(int fd)
{ {
int fl = fcntl(fd, F_GETFL, 0); int fl = fcntl(fd, F_GETFL, 0);
if (!(fl & O_NONBLOCK))
return;
fcntl(fd, F_SETFL, fl & ~O_NONBLOCK); fcntl(fd, F_SETFL, fl & ~O_NONBLOCK);
} }