Check if jna-posix used a fallback java impl which does not support many operations.

If so, don't use posix in Util.createSymlink.
When posix IS used but fails, include errno in log.


git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@23470 71c3de6d-444a-0410-be80-ed276b4c234a
This commit is contained in:
mindless committed 2009-11-04 19:25:14 +00:00
1 parent cd9232853c
commit c825c2bbfd
2 files changed
+14 -4

No files matched your search

+5 -4
View File
@@ -964,15 +964,16 @@ public class Util {
new LocalProc(new String[]{"rm","-rf", symlinkPath},new String[0],listener.getLogger(), baseDir).join();
int r;
if (!SYMLINK_ESCAPEHATCH)
String errMsg = "";
if (!SYMLINK_ESCAPEHATCH && PosixAPI.isNative()) {
r = PosixAPI.get().symlink(targetPath,symlinkFile.getAbsolutePath());
else // escape hatch, until we know that the above works well.
if (r!=0) errMsg = " errno=" + PosixAPI.get().errno();
} else // escape hatch, until we know that the above works well.
r = new LocalProc(new String[]{
"ln","-s", targetPath, symlinkPath},
new String[0],listener.getLogger(), baseDir).join();
if(r!=0)
listener.getLogger().println("ln failed: "+r);
listener.getLogger().println("ln failed: "+r+errMsg);
} catch (IOException e) {
PrintStream log = listener.getLogger();
log.println("ln failed");