Permalink
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...
1 parent 20e8ac1 commit f7d23b55b5ae716a8b29dc8bad25a8416f9e067f @Raptor399 Raptor399 committed May 14, 2013
Showing with 12 additions and 0 deletions.
  1. +12 −0 src/main/java/net/pms/PMS.java
@@ -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();

0 comments on commit f7d23b5

Please sign in to comment.