From: Samuel Thibault Date: Tue, 8 Mar 2016 18:15:08 +0000 (-0600) Subject: Make sure the runtime directory exists X-Git-Tag: AT_SPI2_ATK_2_19_92~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=37bba7de596f3922cb7f14e48eeb6843dac64fbc;p=platform%2Fupstream%2Fat-spi2-atk.git 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 --- 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;