changeset 774:35f4d27451fd

Pipes moved into XDG_RUNTIME_DIR
author Jiri Vanek <jvanek@redhat.com>
date Fri, 29 Nov 2013 12:43:10 +0100
parents 461eb0b77b53
children f055f0ed886d
files ChangeLog NEWS plugin/icedteanp/IcedTeaNPPlugin.cc plugin/icedteanp/IcedTeaPluginUtils.cc plugin/icedteanp/IcedTeaPluginUtils.h
diffstat 5 files changed, 45 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Wed Nov 27 14:14:14 2013 +0100
+++ b/ChangeLog	Fri Nov 29 12:43:10 2013 +0100
@@ -1,3 +1,14 @@
+2013-11-29  Jiri Vanek  <jvanek@redhat.com>
+
+	Pipes moved into XDG_RUNTIME_DIR
+	* plugin/icedteanp/IcedTeaNPPlugin.cc: (initialize_data_directory) logic
+	responsible for tmp dir path moved into (getTmpPath) and (data_directory)
+	initialized from (getRuntimePath) rather.
+	*  plugin/icedteanp/IcedTeaPluginUtils.cc: (getTmpPath) new function,
+	provides path to tmp dir. (getRuntimePath) new function resolving 
+	XDG_RUNTIME_DIR value, returning (getTmpPath) as fallback.
+	* plugin/icedteanp/IcedTeaPluginUtils.h: declared new two methods.
+
 2013-11-26  Jiri Vanek  <jvanek@redhat.com>
 
 	* netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java: (getManifestAttribute)
--- a/NEWS	Wed Nov 27 14:14:14 2013 +0100
+++ b/NEWS	Fri Nov 29 12:43:10 2013 +0100
@@ -22,6 +22,7 @@
   - PR1473 - javaws should not depend on name of local file
 * Plugin
   - PR854: Resizing an applet several times causes 100% CPU load
+  - Pipes moved into XDG_RUNTIME_DIR
 * Security Updates
   - CVE-2012-4540, RH869040: Heap-based buffer overflow after triggering event attached to applet
 
--- a/plugin/icedteanp/IcedTeaNPPlugin.cc	Wed Nov 27 14:14:14 2013 +0100
+++ b/plugin/icedteanp/IcedTeaNPPlugin.cc	Fri Nov 29 12:43:10 2013 +0100
@@ -1886,24 +1886,7 @@
   // Make sure the plugin data directory exists, creating it if
   // necessary.
 
-  const char* tmpdir_env = getenv("TMPDIR");
-  if (tmpdir_env != NULL && g_file_test (tmpdir_env,
-                    (GFileTest) (G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR)))
-    {
-      data_directory = tmpdir_env;
-    }
-  else if (g_file_test (P_tmpdir,
-                    (GFileTest) (G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR)))
-    {
-      data_directory = P_tmpdir;
-    }
-  else
-    {
-      // If TMPDIR and P_tmpdir do not exist, try /tmp directly
-      data_directory = "/tmp";
-    }
-
-  data_directory += "/icedteaplugin-";
+  data_directory = IcedTeaPluginUtilities::getRuntimePath() + "/icedteaplugin-";
   if (getenv("USER") != NULL)
       data_directory += getenv("USER");
 
--- a/plugin/icedteanp/IcedTeaPluginUtils.cc	Wed Nov 27 14:14:14 2013 +0100
+++ b/plugin/icedteanp/IcedTeaPluginUtils.cc	Fri Nov 29 12:43:10 2013 +0100
@@ -1074,6 +1074,36 @@
 }
 
 
+std::string IcedTeaPluginUtilities::getTmpPath(){
+  const char* tmpdir_env = getenv("TMPDIR");
+  if (tmpdir_env != NULL && g_file_test (tmpdir_env,
+                    (GFileTest) (G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR)))
+  {
+    return std::string(tmpdir_env);
+  }
+  else if (g_file_test (P_tmpdir,
+                    (GFileTest) (G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR)))
+  {
+    return std::string(P_tmpdir);
+  }
+  else
+  {
+    // If TMPDIR and P_tmpdir do not exist, try /tmp directly
+    return "/tmp";
+  }
+}
+
+std::string IcedTeaPluginUtilities::getRuntimePath(){
+ const char* rntdir_env = getenv("XDG_RUNTIME_DIR");
+  if (rntdir_env != NULL && g_file_test (rntdir_env,
+                    (GFileTest) (G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR)))
+  {
+    return std::string(rntdir_env);
+  }
+  return IcedTeaPluginUtilities::getTmpPath();
+}
+
+
 /******************************************
  * Begin JavaMessageSender implementation *
  ******************************************
--- a/plugin/icedteanp/IcedTeaPluginUtils.h	Wed Nov 27 14:14:14 2013 +0100
+++ b/plugin/icedteanp/IcedTeaPluginUtils.h	Fri Nov 29 12:43:10 2013 +0100
@@ -286,7 +286,8 @@
         /*cutting whitespaces from end and start of string*/
         static void trim(std::string& str);
         static bool file_exists(std::string filename);
-
+        static std::string getTmpPath();
+        static std::string getRuntimePath();
 };
 
 /*