[at-spi2-atk] Make sure the runtime directory exists



commit 37bba7de596f3922cb7f14e48eeb6843dac64fbc
Author: Samuel Thibault <samuel thibault ens-lyon org>
Date:   Tue Mar 8 12:15:08 2016 -0600

    Make sure the runtime directory exists
    
    It may happen that the home directory of the user does not contain the
    runtime directory yet, when it's a freshly-created home for instance.
    In that case, establishing the p2p socket in spi_atk_create_socket
    will fail since it only tries to create a socket in that directory
    without checking that the directory exists.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=763274

 atk-adaptor/bridge.c |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)
---
diff --git a/atk-adaptor/bridge.c b/atk-adaptor/bridge.c
index 76543e9..e76e833 100644
--- a/atk-adaptor/bridge.c
+++ b/atk-adaptor/bridge.c
@@ -873,16 +873,20 @@ spi_atk_create_socket (SpiBridge *app)
 #ifndef DISABLE_P2P
   DBusServer *server;
   DBusError error;
+  const gchar *user_runtime_dir = g_get_user_runtime_dir ();
+
+  if (g_mkdir_with_parents (user_runtime_dir, 0700) != 0)
+    return -1;
 
   if (getuid () != 0)
   {
-    app->app_tmp_dir = g_build_filename (g_get_user_runtime_dir (),
+    app->app_tmp_dir = g_build_filename (user_runtime_dir,
                                          "at-spi2-XXXXXX", NULL);
     if (!g_mkdtemp (app->app_tmp_dir))
     {
       g_free (app->app_tmp_dir);
       app->app_tmp_dir = NULL;
-      return FALSE;
+      return -1;
     }
   }
 
@@ -890,7 +894,7 @@ spi_atk_create_socket (SpiBridge *app)
     app->app_bus_addr = g_strdup_printf ("unix:path=%s/socket", app->app_tmp_dir);
   else
     app->app_bus_addr = g_strdup_printf ("unix:path=%s/at-spi2-socket-%d",
-                                         g_get_user_runtime_dir (), getpid ());
+                                         user_runtime_dir, getpid ());
 
   if (!spi_global_app_data->app_bus_addr)
     return -1;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]