about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <e@yhbt.net>2011-02-04 06:21:07 +0000
committerEric Wong <e@yhbt.net>2011-02-04 06:32:42 +0000
commit7fbb141402974a91ff925e3f303b1bc2c698b0d4 (patch)
tree2779ce9847a538eb24d4a1c52337be321a71420a
parentc02141cbfa965a19b236e4f9a09856bd2fcacca0 (diff)
downloadsleepy_penguin-7fbb141402974a91ff925e3f303b1bc2c698b0d4.tar.gz
Oops :x   This changes/fixes some minor misbehavior.
-rw-r--r--ext/sleepy_penguin/epoll.c3
-rw-r--r--test/test_epoll_optimizations.rb4
2 files changed, 3 insertions, 4 deletions
diff --git a/ext/sleepy_penguin/epoll.c b/ext/sleepy_penguin/epoll.c
index 4630307..b439390 100644
--- a/ext/sleepy_penguin/epoll.c
+++ b/ext/sleepy_penguin/epoll.c
@@ -289,7 +289,7 @@ fallback_add:
 static VALUE delete(VALUE self, VALUE io)
 {
         struct rb_epoll *ep = ep_get(self);
-        int fd;
+        int fd = my_fileno(io);
         int rv;
         VALUE cur_io;
 
@@ -297,7 +297,6 @@ static VALUE delete(VALUE self, VALUE io)
         if (my_io_closed(io))
                 goto out;
 
-        fd = my_fileno(io);
         cur_io = rb_ary_entry(ep->marks, fd);
         if (NIL_P(cur_io) || my_io_closed(cur_io))
                 return Qnil;
diff --git a/test/test_epoll_optimizations.rb b/test/test_epoll_optimizations.rb
index b4280d8..8cbf07b 100644
--- a/test/test_epoll_optimizations.rb
+++ b/test/test_epoll_optimizations.rb
@@ -90,8 +90,8 @@ class TestEpollOptimizations < Test::Unit::TestCase
     @wr.close
     io, err = Strace.me { rv = @ep.delete(obj) }
     lines = io.readlines; io.close
-    assert_nil err
-    assert_equal obj, rv
+    assert_kind_of IOError, err
+    assert_nil rv
     assert_equal 0, lines.grep(/^epoll_ctl/).size
   end