|
|
@@ -371,22 +371,28 @@ public class FS_POSIX extends FS { |
|
|
|
return true; |
|
|
|
} |
|
|
|
Path lockPath = lock.toPath(); |
|
|
|
Path link = Files.createLink(Paths.get(lock.getAbsolutePath() + ".lnk"), //$NON-NLS-1$ |
|
|
|
lockPath); |
|
|
|
Path link = null; |
|
|
|
try { |
|
|
|
link = Files.createLink( |
|
|
|
Paths.get(lock.getAbsolutePath() + ".lnk"), //$NON-NLS-1$ |
|
|
|
lockPath); |
|
|
|
Integer nlink = (Integer) (Files.getAttribute(lockPath, |
|
|
|
"unix:nlink")); //$NON-NLS-1$ |
|
|
|
if (nlink != 2) { |
|
|
|
if (nlink > 2) { |
|
|
|
LOG.warn("nlink of link to lock file {0} was not 2 but {1}", //$NON-NLS-1$ |
|
|
|
lock.getPath(), nlink); |
|
|
|
return false; |
|
|
|
} else if (nlink < 2) { |
|
|
|
supportsUnixNLink = false; |
|
|
|
} |
|
|
|
return true; |
|
|
|
} catch (UnsupportedOperationException | IllegalArgumentException e) { |
|
|
|
supportsUnixNLink = false; |
|
|
|
return true; |
|
|
|
} finally { |
|
|
|
Files.delete(link); |
|
|
|
if (link != null) { |
|
|
|
Files.delete(link); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |