[uim-commit] r1490 - in trunk: . helper qt uim xim
ekato at freedesktop.org
ekato at freedesktop.org
Mon Sep 12 13:18:06 PDT 2005
Author: ekato
Date: 2005-09-12 13:18:03 -0700 (Mon, 12 Sep 2005)
New Revision: 1490
Modified:
trunk/configure.ac
trunk/helper/Makefile.am
trunk/qt/Makefile.am
trunk/uim/Makefile.am
trunk/uim/uim-helper-client.c
trunk/uim/uim-ipc.c
trunk/xim/canddisp.cpp
Log:
* Install uim-candwin-{gtk,qt} and uim-helper-server into
libexecdir instead of bindir.
* configure.ac : Define UIM_LIBEXECDIR as libexecdir.
* qt/Makefile.am : Install uim-candwin-qt into libexecdir.
* helper/Makefile.am : Install uim-candwin-gtk into libexecdir.
* uim/Makefile.am : Install uim-helper-server into libexecdir.
* uim/uim-ipc.c (uim_ipc_open_command_with_option) : Search
UIM_LIBEXECDIR path when is_setugid is true.
* uim/uim-helper-client.c (get_server_command) : Prepend
UIM_LIBEXECDIR for command path.
* xim/canddisp.cpp (candwin_command) : Prepend UIM_LIBEXECDIR
for command path.
Modified: trunk/configure.ac
===================================================================
--- trunk/configure.ac 2005-09-12 18:42:42 UTC (rev 1489)
+++ trunk/configure.ac 2005-09-12 20:18:03 UTC (rev 1490)
@@ -243,6 +243,8 @@
AC_DEFINE_UNQUOTED(LIBDIR, "$LIBDIR", [libraries dir])
DATADIR=`eval echo ${datadir}`
AC_DEFINE_UNQUOTED(DATADIR, "$DATADIR", [read-only architecture-independent data dir])
+UIM_LIBEXECDIR=`eval echo "${libexecdir}"`
+AC_DEFINE_UNQUOTED(UIM_LIBEXECDIR, "$UIM_LIBEXECDIR", [libexec dir])
# we should use more safe macro such as AC_EXPAND_DIR
LOCALEDIR=`eval echo ${datadir}/locale`
# backward compatibility
Modified: trunk/helper/Makefile.am
===================================================================
--- trunk/helper/Makefile.am 2005-09-12 18:42:42 UTC (rev 1489)
+++ trunk/helper/Makefile.am 2005-09-12 20:18:03 UTC (rev 1490)
@@ -38,7 +38,12 @@
if GTK2
-bin_PROGRAMS = uim-candwin-gtk uim-toolbar-gtk uim-toolbar-gtk-systray uim-im-switcher-gtk uim-input-pad-ja
+bin_PROGRAMS = uim-toolbar-gtk uim-toolbar-gtk-systray uim-im-switcher-gtk uim-input-pad-ja
+if APPLET
+libexec_PROGRAMS += uim-candwin-gtk
+else
+libexec_PROGRAMS = uim-candwin-gtk
+endif
if DICT
bin_PROGRAMS += uim-dict-gtk
@@ -92,10 +97,9 @@
install-exec-hook-gtk2:
cd $(DESTDIR)$(bindir) && \
- rm -f uim-helper-candwin-gtk uim-helper-toolbar-gtk uim-helper-toolbar-gtk-systray && \
- $(LN_S) uim-candwin-gtk uim-helper-candwin-gtk && \
+ rm -f uim-helper-toolbar-gtk uim-helper-toolbar-gtk-systray && \
$(LN_S) uim-toolbar-gtk uim-helper-toolbar-gtk && \
- $(LN_S) uim-toolbar-gtk-systray uim-helper-toolbar-gtk-systray
+ $(LN_S) uim-toolbar-gtk-systray uim-helper-toolbar-gtk-systray
else
install-exec-hook-gtk2:
true # dummy
Modified: trunk/qt/Makefile.am
===================================================================
--- trunk/qt/Makefile.am 2005-09-12 18:42:42 UTC (rev 1489)
+++ trunk/qt/Makefile.am 2005-09-12 20:18:03 UTC (rev 1490)
@@ -51,11 +51,12 @@
bin_PROGRAMS = \
uim-toolbar-qt \
- uim-candwin-qt \
uim-im-switcher-qt \
uim-pref-qt \
uim-chardict-qt
+libexec_PROGRAMS = uim-candwin-qt
+
# Immodule
if QT_IMMODULE
extra_LTLIBRARIES = libquiminputcontextplugin.la
Modified: trunk/uim/Makefile.am
===================================================================
--- trunk/uim/Makefile.am 2005-09-12 18:42:42 UTC (rev 1489)
+++ trunk/uim/Makefile.am 2005-09-12 20:18:03 UTC (rev 1490)
@@ -105,7 +105,8 @@
libuim_custom_enabler_la_CPPFLAGS = -I$(top_srcdir)
-bin_PROGRAMS = uim-helper-server uim-sh uim-module-manager
+bin_PROGRAMS = uim-sh uim-module-manager
+libexec_PROGRAMS = uim-helper-server
uim_helper_server_LIBS =
uim_helper_server_CPPFLAGS = $(uim_defs) -I$(top_srcdir)
Modified: trunk/uim/uim-helper-client.c
===================================================================
--- trunk/uim/uim-helper-client.c 2005-09-12 18:42:42 UTC (rev 1489)
+++ trunk/uim/uim-helper-client.c 2005-09-12 20:18:03 UTC (rev 1490)
@@ -61,7 +61,7 @@
static char *
get_server_command(void)
{
- return "uim-helper-server";
+ return UIM_LIBEXECDIR "/uim-helper-server";
}
int uim_helper_init_client_fd(void (*disconnect_cb)(void))
Modified: trunk/uim/uim-ipc.c
===================================================================
--- trunk/uim/uim-ipc.c 2005-09-12 18:42:42 UTC (rev 1489)
+++ trunk/uim/uim-ipc.c 2005-09-12 20:18:03 UTC (rev 1490)
@@ -201,17 +201,26 @@
if (is_setugid() != 0) {
int cmd_len = strlen(command) + 30;
char *fullpath_command = malloc(cmd_len);
-
+ char *cmd_name = strrchr(command, '/');
+
+ if (cmd_name && cmd_name + 1 != '\0')
+ cmd_name++;
+ else
+ cmd_name = (char *)command;
/*if (setuid(getuid())!=0) abort();*/ /* discarding privilege */
- snprintf(fullpath_command, cmd_len, "/usr/local/bin/%s", command);
+ snprintf(fullpath_command, cmd_len, "/usr/local/bin/%s", cmd_name);
result = execvp(fullpath_command, argv);
if (result == -1) {
- snprintf(fullpath_command, cmd_len, "/usr/bin/%s", command);
+ snprintf(fullpath_command, cmd_len, "/usr/bin/%s", cmd_name);
result = execvp(fullpath_command, argv);
}
+ if (result == -1) {
+ snprintf(fullpath_command, cmd_len, UIM_LIBEXECDIR "/%s", cmd_name);
+ result = execvp(fullpath_command, argv);
+ }
free(fullpath_command);
} else {
result = execvp(command, argv);
Modified: trunk/xim/canddisp.cpp
===================================================================
--- trunk/xim/canddisp.cpp 2005-09-12 18:42:42 UTC (rev 1489)
+++ trunk/xim/canddisp.cpp 2005-09-12 20:18:03 UTC (rev 1490)
@@ -52,6 +52,11 @@
#include "canddisp.h"
#include "util.h"
+#if defined(USE_QT_CANDWIN)
+ #define DEFAULT_CANDWIN_PROG (UIM_LIBEXECDIR "/uim-candwin-qt")
+#elif defined(USE_GTK_CANDWIN) && defined(USE_GTK2)
+ #define DEFAULT_CANDWIN_PROG (UIM_LIBEXECDIR "/uim-candwin-gtk")
+#endif
static FILE *candwin_r, *candwin_w;
static int candwin_pid;
@@ -63,7 +68,8 @@
static const char *candwin_command(void)
{
- char *candwin_prog = NULL;
+ char *candwin_prog;
+ const char *user_config;
/*
XXX: We should drop uim-compat-scm API. -- omote 07/12/2005
@@ -75,22 +81,18 @@
3. default toolkit's candwin program determined by ./configure
*/
- candwin_prog = getenv("UIM_CANDWIN_PROG");
- if (!candwin_prog) {
+ user_config = getenv("UIM_CANDWIN_PROG");
#ifdef UIM_COMPAT_SCM
- candwin_prog = uim_scm_symbol_value_str("uim-candwin-prog");
- if (candwin_prog)
- return candwin_prog;
-#endif /* UIM_COMPAT_SCM */
-#if defined(USE_QT_CANDWIN)
- return "uim-candwin-qt";
-#elif defined(USE_GTK_CANDWIN) && defined(USE_GTK2)
- return "uim-candwin-gtk";
-#else
- return NULL;
+ if (!user_config)
+ user_config = uim_scm_symbol_value_str("uim-candwin-prog");
#endif
- } else
+
+ if (user_config) {
+ asprintf(&candwin_prog, UIM_LIBEXECDIR "/%s", user_config);
return candwin_prog;
+ }
+
+ return DEFAULT_CANDWIN_PROG;
}
Canddisp *canddisp_singleton()
More information about the uim-commit
mailing list