[uim-commit] r2634 - trunk/uim

ekato at freedesktop.org ekato at freedesktop.org
Sat Dec 17 06:23:59 PST 2005


Author: ekato
Date: 2005-12-17 06:23:51 -0800 (Sat, 17 Dec 2005)
New Revision: 2634

Modified:
   trunk/uim/skk.c
Log:
* uim/skk.c : Include "uim-helper.h" for is
  uim_helper_is_setugid().
(look_popen) : Use fullpath command when setugid.


Modified: trunk/uim/skk.c
===================================================================
--- trunk/uim/skk.c	2005-12-17 13:04:45 UTC (rev 2633)
+++ trunk/uim/skk.c	2005-12-17 14:23:51 UTC (rev 2634)
@@ -55,6 +55,7 @@
 #include <arpa/inet.h>
 
 #include "uim-scm.h"
+#include "uim-helper.h"
 #include "plugin.h"
 
 #define skk_isalpha(ch)	(skk_islower(ch) || skk_isupper(ch))
@@ -3341,18 +3342,24 @@
 static FILE *
 look_popen(const char *str)
 {
-  char *command;
+  char *cmd;
+  const char *look;
   FILE *fp;
   int len;
   
-  len = strlen(LOOK_COMMAND) + strlen(str) + strlen(" 2>/dev/null") + 1;
-  command = malloc(len + 1);
-  if (!command)
+  if (uim_helper_is_setugid()) 
+    look = "/usr/bin/" LOOK_COMMAND;
+  else
+    look = LOOK_COMMAND;
+
+  len = strlen(look) + strlen(str) + strlen(" 2>/dev/null") + 1;
+  cmd = malloc(len + 1);
+  if (!cmd)
     return NULL;
 
-  snprintf(command, len + 1, "%s %s%s", LOOK_COMMAND, str, " 2>/dev/null");
-  fp = popen(command, "r");
-  free(command);
+  snprintf(cmd, len + 1, "%s %s%s", look, str, " 2>/dev/null");
+  fp = popen(cmd, "r");
+  free(cmd);
 
   return fp;
 }



More information about the uim-commit mailing list