changeset 1997:1188b1a313b9 icedtea6-1.8-branchpoint

Changed FIFO file location from /tmp/$user-... to /tmp/icedteaplugin-$user/$pid-...
author Deepak Bhole <dbhole@redhat.com>
date Mon, 22 Mar 2010 15:34:55 -0400
parents 7857039dc3da
children 1b92ba827a7e
files ChangeLog plugin/icedteanp/IcedTeaNPPlugin.cc
diffstat 2 files changed, 37 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Fri Mar 19 17:46:05 2010 +0000
+++ b/ChangeLog	Mon Mar 22 15:34:55 2010 -0400
@@ -1,3 +1,9 @@
+2010-03-22  Deepak Bhole <dbhole@redhat.com>
+
+	* plugin/icedteanp/IcedTeaNPPlugin.cc
+	(start_jvm_if_needed): Change pipe file name format.
+	(NP_Initialize): Put FIFO pipe in a separate per-user directory.
+
 2010-03-19  Andrew John Hughes  <ahughes@redhat.com>
 
 	* Makefile.am:
--- a/plugin/icedteanp/IcedTeaNPPlugin.cc	Fri Mar 19 17:46:05 2010 +0000
+++ b/plugin/icedteanp/IcedTeaNPPlugin.cc	Mon Mar 22 15:34:55 2010 -0400
@@ -434,8 +434,8 @@
   // pipe.
 
   // in_pipe_name
-  in_pipe_name = g_strdup_printf ("%s/%s-icedteanp-appletviewer-to-plugin",
-                                         data_directory, getenv ("USER"));
+  in_pipe_name = g_strdup_printf ("%s/%d-icedteanp-appletviewer-to-plugin",
+                                         data_directory, getpid());
   if (!in_pipe_name)
     {
       PLUGIN_ERROR ("Failed to create input pipe name.");
@@ -461,8 +461,8 @@
   // output pipe.
 
   // out_pipe_name
-  out_pipe_name = g_strdup_printf ("%s/%s-icedteanp-plugin-to-appletviewer",
-                                         data_directory, getenv ("USER"));
+  out_pipe_name = g_strdup_printf ("%s/%d-icedteanp-plugin-to-appletviewer",
+                                         data_directory, getpid());
 
   if (!out_pipe_name)
     {
@@ -1992,7 +1992,33 @@
 
     }
 
-  // If that doesn't exit, bail
+  data_directory = g_strconcat (data_directory, "/icedteaplugin-", getenv("USER"), NULL);
+
+  if (!data_directory)
+  {
+      PLUGIN_ERROR ("Failed to create data directory name.");
+      return NPERR_OUT_OF_MEMORY_ERROR;
+  }
+
+  // Now create a icedteaplugin subdir
+  if (!g_file_test (data_directory,
+                    (GFileTest) (G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR)))
+    {
+      int file_error = 0;
+
+      file_error = g_mkdir (data_directory, 0700);
+      if (file_error != 0)
+        {
+          PLUGIN_ERROR_THREE ("Failed to create data directory",
+                          data_directory,
+                          strerror (errno));
+          np_error = NPERR_GENERIC_ERROR;
+          goto cleanup_data_directory;
+        }
+    }
+
+
+  // If data directory doesn't exit by this point, bail
   if (!g_file_test (data_directory,
                     (GFileTest) (G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR)))
     {