diff --git a/core/src/main/java/org/jruby/RubyIO.java b/core/src/main/java/org/jruby/RubyIO.java index 784692ac7e3..3dbec5f4cbc 100644 --- a/core/src/main/java/org/jruby/RubyIO.java +++ b/core/src/main/java/org/jruby/RubyIO.java @@ -3784,14 +3784,14 @@ public IRubyObject advise(ThreadContext context, IRubyObject[] argv) { POSIX posix = runtime.getNativePosix(); - if (!(posix instanceof Linux)) { - return context.nil; - } - RubyIO io = GetWriteIO(); fptr = io.getOpenFileChecked(); + if (!(posix instanceof Linux)) { + return context.nil; + } + int fd = fptr.fd().realFileno; if (fd == -1) {