summaryrefslogtreecommitdiff
path: root/io.c
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-05-22 22:12:57 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-05-22 22:12:57 +0000
commit078a760999a4ee00f59db3f07047070e71316e13 (patch)
tree36aaf66609707eca5a0cce6961f5734b55ec5540 /io.c
parentdc3037bc487010b8e9368ce09aa6e7c92b6ce3da (diff)
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
Diffstat (limited to 'io.c')
-rw-r--r--io.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/io.c b/io.c
index 22257b65ae..83c51f4437 100644
--- a/io.c
+++ b/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);
+ }
}
}