diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2016-03-08 12:15:08 -0600 |
---|---|---|
committer | Mike Gorse <mgorse@suse.com> | 2016-03-08 12:15:08 -0600 |
commit | 37bba7de596f3922cb7f14e48eeb6843dac64fbc (patch) | |
tree | aad3339c73b09c9cbe2ba375f03239d68a299e99 | |
parent | 4b9c9e670303db83ec907f981342618b2679c8af (diff) | |
download | at-spi2-atk-37bba7de596f3922cb7f14e48eeb6843dac64fbc.tar.gz |
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
-rw-r--r-- | 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; |