about summary refs log tree commit homepage
path: root/ext/kgio/tryopen.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/kgio/tryopen.c')
-rw-r--r--ext/kgio/tryopen.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/ext/kgio/tryopen.c b/ext/kgio/tryopen.c
index 0ee6a54..5fa6ada 100644
--- a/ext/kgio/tryopen.c
+++ b/ext/kgio/tryopen.c
@@ -106,7 +106,7 @@ static VALUE s_tryopen(int argc, VALUE *argv, VALUE klass)
 
 retry:
         fd = (int)rb_thread_blocking_region(nogvl_open, &o, RUBY_UBF_IO, 0);
-        if (fd == -1) {
+        if (fd < 0) {
                 if (errno == EMFILE || errno == ENFILE || errno == ENOMEM) {
                         rb_gc();
                         if (retried)
@@ -114,7 +114,7 @@ retry:
                         retried = 1;
                         goto retry;
                 }
-                if (fd == -1) {
+                if (fd < 0) {
                         int saved_errno = errno;
 
                         if (!st_lookup(errno2sym, (st_data_t)errno, &rv)) {