[at-spi2-atk/p2p: 3/5] improve how the dbus address is handled



commit 9f1335d701d7c4ee0217d5a28c31a9e85a99da32
Author: Trevor Saunders <trev saunders gmail com>
Date:   Thu Aug 5 19:11:34 2010 -0400

    improve how the dbus address is handled
    
    Create unique socket names of the form
    /tmp/at-spi2/socket-<pid>-<random number> This should be much safer
    than the old method since each process should have only one dbus
    server socket, and the random number should protect against uncleaned
    up sockets.
    
    Also set permissions on directory for dbus server sockets.

 atk-adaptor/bridge.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/atk-adaptor/bridge.c b/atk-adaptor/bridge.c
index 80d3f8e..86dcc82 100644
--- a/atk-adaptor/bridge.c
+++ b/atk-adaptor/bridge.c
@@ -32,6 +32,7 @@
 #include <stdio.h>
 #include <stdarg.h>
 #include <string.h>
+#include<sys/stat.h>
 #include <atk/atk.h>
 
 #include <droute/droute.h>
@@ -332,8 +333,10 @@ register_application (SpiBridge * app)
 
 /* could this be better, we accept some amount of race in getting the temp name*/
 /* make sure the directory exists */
-mkdir("/tmp/at-spi2/", 0);
-app->app_bus_addr = mktemp(file_template);
+mkdir("/tmp/at-spi2/", S_IRWXU);
+app->app_bus_addr = g_malloc(max_addr_length * sizeof(char));
+sprintf(app->app_bus_addr, "unix:path=/tmp/at-spi2/socket-%d-%d", getpid(),
+rand());
     }
   else
     {



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