Try to create dir $(HOME)/.config/ibus/bus every time to avoid apps wake
authorPeng Huang <shawn.p.huang@gmail.com>
Thu, 8 Apr 2010 03:10:02 +0000 (11:10 +0800)
committerPeng Huang <shawn.p.huang@gmail.com>
Thu, 8 Apr 2010 03:10:02 +0000 (11:10 +0800)
up once per second.

src/ibusbus.c
src/ibusshare.c
src/ibusshare.h

index d88e188..33573a3 100644 (file)
@@ -208,20 +208,15 @@ ibus_bus_init (IBusBus *bus)
 
     path = g_path_get_dirname (ibus_get_socket_path ());
 
+    g_mkdir_with_parents (path, 0700);
+    g_chmod (path, 0700);
+
     if (stat (path, &buf) == 0) {
-        if (buf.st_uid != ibus_get_daemon_uid ()) {
+        if (buf.st_uid != getuid ()) {
             g_warning ("The owner of %s is not %s!", path, ibus_get_user_name ());
             return;
         }
     }
-#if 0
-    else {
-        if (getuid () == ibus_get_daemon_uid ()) {
-            mkdir (path, 0700);
-            chmod (path, 0700);
-        }
-    }
-#endif
 
     ibus_bus_connect (bus);
 
index aee549f..f66a2d3 100644 (file)
@@ -27,7 +27,6 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
-#include <pwd.h>
 #include <dbus/dbus.h>
 #include "ibusshare.h"
 
@@ -58,6 +57,8 @@ ibus_set_display (const gchar *display)
 const gchar *
 ibus_get_user_name (void)
 {
+    return g_get_user_name ();
+#if 0
     static gchar *username = NULL;
     if (username == NULL) {
         username = g_strdup (getlogin());
@@ -87,11 +88,14 @@ ibus_get_user_name (void)
 
     }
     return username;
+#endif
 }
 
 glong
 ibus_get_daemon_uid (void)
 {
+    return getuid ();
+#if 0
     struct passwd *pwd;
     uid_t uid;
     const gchar *username;
@@ -110,6 +114,7 @@ ibus_get_daemon_uid (void)
         return 0;
 
     return pwd->pw_uid;
+#endif
 }
 
 const gchar *
index e622be2..26677a3 100644 (file)
@@ -219,8 +219,11 @@ const gchar     *ibus_get_user_name     (void);
  * @returns: UID of ibus-daemon; or 0 if UID is not available.
  *
  * Get UID of ibus-daemon.
+ *
+ * Deprecated: This function has been deprecated and should
+ * not be used in newly written code.
  */
-glong            ibus_get_daemon_uid    (void);
+glong            ibus_get_daemon_uid    (void) G_GNUC_DEPRECATED;
 
 /**
  * ibus_get_socket_path: