mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
avoid useless fcntl in rb_io_set_nonblock.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10180 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
dc3037bc48
commit
078a760999
1 changed files with 5 additions and 3 deletions
8
io.c
8
io.c
|
@ -1247,9 +1247,11 @@ void rb_io_set_nonblock(OpenFile *fptr)
|
|||
#else
|
||||
flags = 0;
|
||||
#endif
|
||||
flags |= O_NONBLOCK;
|
||||
if (fcntl(fptr->fd, F_SETFL, flags) == -1) {
|
||||
rb_sys_fail(fptr->path);
|
||||
if ((flags & O_NONBLOCK) == 0) {
|
||||
flags |= O_NONBLOCK;
|
||||
if (fcntl(fptr->fd, F_SETFL, flags) == -1) {
|
||||
rb_sys_fail(fptr->path);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue