diff --git a/core/src/main/java/hudson/Util.java b/core/src/main/java/hudson/Util.java index 16eed1aafcc1b3b1bab8e2a271658d7a253880bb..2ec33cf57f10bf6708c68f22bfe80c961dd6ee60 100644 --- a/core/src/main/java/hudson/Util.java +++ b/core/src/main/java/hudson/Util.java @@ -1014,9 +1014,10 @@ public class Util { Memory m = new Memory(sz); int r = GNUCLibrary.LIBC.readlink(filename,m,new NativeLong(sz)); if (r<0) { - if (r==22/*EINVAL --- but is this really portable?*/) + int err = Native.getLastError(); + if (err==22/*EINVAL --- but is this really portable?*/) return null; // this means it's not a symlink - throw new IOException("Failed to readlink "+link+" error="+Native.getLastError()); + throw new IOException("Failed to readlink "+link+" error="+ err); } if (r==sz) continue; // buffer too small