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:
parent
3a39c65e3e
commit
a2e4f9a8aa
@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user