diff --git a/onionwrapper-core/src/main/java/org/briarproject/onionwrapper/AbstractTorWrapper.java b/onionwrapper-core/src/main/java/org/briarproject/onionwrapper/AbstractTorWrapper.java index 99733387dcbe00c9509fa0396df2cc30f53bdc69..a92b8cbcc11e29efc6950bb5162d6bb609889180 100644 --- a/onionwrapper-core/src/main/java/org/briarproject/onionwrapper/AbstractTorWrapper.java +++ b/onionwrapper-core/src/main/java/org/briarproject/onionwrapper/AbstractTorWrapper.java @@ -229,6 +229,10 @@ abstract class AbstractTorWrapper implements EventHandler, TorWrapper { LOG.info("Installing Tor binary for " + architecture); } File torFile = getTorExecutableFile(); + // Important: delete file here and with other binaries below to prevent + // problems on macOS in case the file signature changed. + //noinspection ResultOfMethodCallIgnored + torFile.delete(); extract(getExecutableInputStream("tor"), torFile); if (!torFile.setExecutable(true, true)) throw new IOException(); } @@ -238,6 +242,8 @@ abstract class AbstractTorWrapper implements EventHandler, TorWrapper { LOG.info("Installing libevent binary for " + architecture); } File libEventFile = getLibEventFile(); + //noinspection ResultOfMethodCallIgnored + libEventFile.delete(); extract(getExecutableInputStream("libevent-2.1.7.dylib"), libEventFile); } @@ -246,6 +252,8 @@ abstract class AbstractTorWrapper implements EventHandler, TorWrapper { LOG.info("Installing obfs4proxy binary for " + architecture); } File obfs4File = getObfs4ExecutableFile(); + //noinspection ResultOfMethodCallIgnored + obfs4File.delete(); extract(getExecutableInputStream("obfs4proxy"), obfs4File); if (!obfs4File.setExecutable(true, true)) throw new IOException(); } @@ -255,6 +263,8 @@ abstract class AbstractTorWrapper implements EventHandler, TorWrapper { LOG.info("Installing snowflake binary for " + architecture); } File snowflakeFile = getSnowflakeExecutableFile(); + //noinspection ResultOfMethodCallIgnored + snowflakeFile.delete(); extract(getExecutableInputStream("snowflake"), snowflakeFile); if (!snowflakeFile.setExecutable(true, true)) throw new IOException(); }