Fix restart problem in Unix
authorPeng Huang <shawn.p.huang@gmail.com>
Tue, 22 Sep 2009 05:01:42 +0000 (13:01 +0800)
committerPeng Huang <shawn.p.huang@gmail.com>
Tue, 22 Sep 2009 05:01:42 +0000 (13:01 +0800)
bus/Makefile.am
bus/ibusimpl.c

index bb0dff9f79a533479e140e0920a14dba7f9e9ec8..7728b50ea1b593830d5d95577f296556fe8cb296 100644 (file)
@@ -32,6 +32,7 @@ AM_CFLAGS = \
        -DG_LOG_DOMAIN=\"IBUS\" \
        -DPKGDATADIR=\"$(pkgdatadir)\" \
        -DLIBEXECDIR=\"$(libexecdir)\" \
+       -DBINDIR=\"@bindir@\" \
        $(INCLUDES) \
        $(NULL)
 AM_LDFLAGS = \
index e841c281e3b488d188219850e4bdbe3e972613fc..fa1ff8557fdbd434232ba9765dbb488dbb8f85d2 100644 (file)
@@ -1105,10 +1105,10 @@ _ibus_exit (BusIBusImpl     *ibus,
         gint fd;
 
         exe = g_strdup_printf ("/proc/%d/exe", getpid ());
-        if (!g_file_test (exe, G_FILE_TEST_EXISTS)) {
-            g_free (exe);
-            exe = g_argv[0];
-        }
+        exe = g_file_read_link (exe, NULL);
+
+        if (exe == NULL)
+            exe = BINDIR"/ibus-daemon";
 
         /* close all fds except stdin, stdout, stderr */
         for (fd = 3; fd <= sysconf (_SC_OPEN_MAX); fd ++) {