Skip to content

Commit

Permalink
Do not lock file for writing on macOS (limited support for network sh…
Browse files Browse the repository at this point in the history
  • Loading branch information
buchen committed Feb 22, 2023
1 parent 80a112b commit 7b26ccb
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
import javax.crypto.spec.SecretKeySpec;

import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.Platform;

import com.google.common.base.Strings;
import com.thoughtworks.xstream.XStream;
Expand Down Expand Up @@ -618,7 +619,12 @@ private static void writeFile(final Client client, final File file, char[] passw
// garbling up the files if it already starts syncing while the file
// is still being written)
FileChannel channel = stream.getChannel();
FileLock lock = channel.tryLock();
FileLock lock = null;

// On OS X fcntl does not support locking files on AFP or SMB
// https://bugs.openjdk.org/browse/JDK-8167023
if (!Platform.getOS().equals(Platform.OS_MACOSX))
lock = channel.tryLock();

ClientPersister persister = buildPersister(flags, password);
persister.save(client, output);
Expand Down

0 comments on commit 7b26ccb

Please sign in to comment.