Author: yamakenz
Date: Sun Aug 12 21:27:56 2007
New Revision: 4837

Modified:
   trunk/uim/uim-helper.c
   trunk/uim/uim-ipc.c

Log:
* uim/uim-ipc.c
  - Exclude uim-helper.h
  - (uim_helper_check_connection_fd): Move to uim-helper.c
* uim/uim-helper.c
  - (uim_helper_check_connection_fd): Moved from uim-ipc.c


Modified: trunk/uim/uim-helper.c
==============================================================================
--- trunk/uim/uim-helper.c      (original)
+++ trunk/uim/uim-helper.c      Sun Aug 12 21:27:56 2007
@@ -177,6 +177,22 @@
   return path;
 }
 
+int
+uim_helper_check_connection_fd(int fd)
+{
+  uid_t euid;
+  gid_t egid;
+  if (getpeereid(fd, &euid, &egid) < 0) {
+    perror("getpeereid failed");
+    return -1;
+  }
+  if ((euid != 0) && (euid != getuid())) {
+    fprintf(stderr, "uid mismatch\n");
+    return -1;
+  }
+  return 0;
+}
+
 int uim_helper_fd_readable(int fd)
 {
   return uim_helper_fd(fd, READ);

Modified: trunk/uim/uim-ipc.c
==============================================================================
--- trunk/uim/uim-ipc.c (original)
+++ trunk/uim/uim-ipc.c Sun Aug 12 21:27:56 2007
@@ -44,7 +44,6 @@
 #include <string.h>
 
 #include "uim-internal.h"
-#include "uim-helper.h"
 #include "uim-util.h"
 
 /* This function is come from the GNU C Library manual */
@@ -290,20 +289,4 @@
   free(tmp);
   *pid = uim_ipc_open_command(*pid, read_fp, write_fp, command);
   return NULL;
-}
-
-int
-uim_helper_check_connection_fd(int fd)
-{
-  uid_t euid;
-  gid_t egid;
-  if (getpeereid(fd, &euid, &egid) < 0) {
-    perror("getpeereid failed");
-    return -1;
-  }
-  if ((euid != 0) && (euid != getuid())) {
-    fprintf(stderr, "uid mismatch\n");
-    return -1;
-  }
-  return 0;
 }

Reply via email to