[at-spi2-core] Bus launcher: ensure that at-spi directory can be created before using



commit 8a6c449701ad0d637a7cc05a1c4b1ba4ee9cb765
Author: Mike Gorse <mgorse suse com>
Date:   Wed Feb 16 17:11:08 2022 -0600

    Bus launcher: ensure that at-spi directory can be created before using
    
    Related to https://gitlab.gnome.org/GNOME/at-spi2-core/issues/43

 bus/at-spi-bus-launcher.c | 22 +++++++++++++---------
 1 file changed, 13 insertions(+), 9 deletions(-)
---
diff --git a/bus/at-spi-bus-launcher.c b/bus/at-spi-bus-launcher.c
index c33ef64c..e552c3fb 100644
--- a/bus/at-spi-bus-launcher.c
+++ b/bus/at-spi-bus-launcher.c
@@ -548,17 +548,21 @@ ensure_a11y_bus (A11yBusLauncher *app)
           g_free (at_spi_dir);
           at_spi_dir = new_dir;
         }
-        mkdir (at_spi_dir, 0700);
-        app->socket_name = g_strconcat (at_spi_dir, "/bus", display, NULL);
-        g_free (at_spi_dir);
-        p = strchr (app->socket_name, ':');
-        if (p)
-          *p = '_';
-        if (strlen (app->socket_name) >= 100)
+        if (mkdir (at_spi_dir, 0700) == 0 || errno == EEXIST)
           {
-            g_free (app->socket_name);
-            app->socket_name = NULL;
+            app->socket_name = g_strconcat (at_spi_dir, "/bus", display, NULL);
+            g_free (at_spi_dir);
+            p = strchr (app->socket_name, ':');
+            if (p)
+              *p = '_';
+            if (strlen (app->socket_name) >= 100)
+              {
+                g_free (app->socket_name);
+                app->socket_name = NULL;
+              }
           }
+        else
+          g_free (at_spi_dir);
       }
 
 #ifdef WANT_DBUS_BROKER


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