From 8b97e9ecbad917af69fd4f70af7ad305d44e48ee Mon Sep 17 00:00:00 2001 From: Peng Huang Date: Tue, 22 Sep 2009 13:01:42 +0800 Subject: [PATCH] Fix restart problem in Unix --- bus/Makefile.am | 1 + bus/ibusimpl.c | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/bus/Makefile.am b/bus/Makefile.am index bb0dff9..7728b50 100644 --- a/bus/Makefile.am +++ b/bus/Makefile.am @@ -32,6 +32,7 @@ AM_CFLAGS = \ -DG_LOG_DOMAIN=\"IBUS\" \ -DPKGDATADIR=\"$(pkgdatadir)\" \ -DLIBEXECDIR=\"$(libexecdir)\" \ + -DBINDIR=\"@bindir@\" \ $(INCLUDES) \ $(NULL) AM_LDFLAGS = \ diff --git a/bus/ibusimpl.c b/bus/ibusimpl.c index e841c28..fa1ff85 100644 --- a/bus/ibusimpl.c +++ b/bus/ibusimpl.c @@ -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 ++) { -- 2.7.4