1
0
Fork 0
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:
akr 2006-05-22 22:12:57 +00:00
parent dc3037bc48
commit 078a760999

8
io.c
View file

@ -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);
}
}
}