Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
WTF is all this logic for? Make readlink pass some more rubyspecs
  • Loading branch information
enebo committed Sep 24, 2014
1 parent 9e2f3d1 commit 084eef9
Showing 1 changed file with 2 additions and 14 deletions.
16 changes: 2 additions & 14 deletions core/src/main/java/org/jruby/RubyFile.java
Expand Up @@ -954,22 +954,10 @@ public static IRubyObject symlink(ThreadContext context, IRubyObject recv, IRuby
public static IRubyObject readlink(ThreadContext context, IRubyObject recv, IRubyObject path) {
Ruby runtime = context.runtime;
JRubyFile link = file(path);

try {
String realPath = runtime.getPosix().readlink(link.toString());

if (!RubyFileTest.exist_p(recv, path).isTrue()) {
throw runtime.newErrnoENOENTError(path.toString());
}

if (!RubyFileTest.symlink_p(recv, path).isTrue()) {
// Can not check earlier, File.exist? might return false yet the symlink be there
if (!RubyFileTest.exist_p(recv, path).isTrue()) {
throw runtime.newErrnoENOENTError(path.toString());
}
throw runtime.newErrnoEINVALError(path.toString());
}


if (realPath == null) {
throw runtime.newErrnoFromLastPOSIXErrno();
}
Expand Down

0 comments on commit 084eef9

Please sign in to comment.