Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added explicit check for java.io.tmpdir to be writable.

JNA may attempt to unpack its own shared library there.

http://www.ps3mediaserver.org/forum/viewtopic.php?f=6&t=16776&p=79153#p79142
  • Loading branch information...
commit f7d23b55b5ae716a8b29dc8bad25a8416f9e067f 1 parent 20e8ac1
Patrick Atoon Raptor399 authored
Showing with 12 additions and 0 deletions.
  1. +12 −0 src/main/java/net/pms/PMS.java
12 src/main/java/net/pms/PMS.java
View
@@ -352,6 +352,18 @@ public void configurationChanged(ConfigurationEvent event) {
LOGGER.info("Working directory: " + cwd);
LOGGER.info("Temp directory: " + configuration.getTempFolder());
+
+ // Verify the java.io.tmpdir is writable; JNA requires it.
+ // Note: the configured tempFolder has already been checked, but it
+ // may differ from the java.io.tmpdir so double check to be sure.
+ File javaTmpdir = new File(System.getProperty("java.io.tmpdir"));
+
+ if (!FileUtil.isDirectoryWritable(javaTmpdir)) {
+ LOGGER.error("The Java temp directory \"" + javaTmpdir.getAbsolutePath() + "\" is not writable for PMS!");
+ LOGGER.error("Please make sure the directory is writable for user \"" + System.getProperty("user.name") + "\"");
+ throw new IOException("Cannot write to Java temp directory");
+ }
+
LOGGER.info("Logging config file: " + LoggingConfigFileLoader.getConfigFilePath());
HashMap<String, String> lfps = LoggingConfigFileLoader.getLogFilePaths();
Please sign in to comment.
Something went wrong with that request. Please try again.