[uim-commit] r574 - trunk/uim
tkng at freedesktop.org
tkng at freedesktop.org
Sun Feb 6 09:38:44 PST 2005
Author: tkng
Date: 2005-02-06 09:38:41 -0800 (Sun, 06 Feb 2005)
New Revision: 574
Modified:
trunk/uim/uim-helper-server.c
Log:
* uim/uim-helper-server.c:
-(init_serv_fd): Change owner of socket path.
Modified: trunk/uim/uim-helper-server.c
===================================================================
--- trunk/uim/uim-helper-server.c 2005-02-06 17:16:05 UTC (rev 573)
+++ trunk/uim/uim-helper-server.c 2005-02-06 17:38:41 UTC (rev 574)
@@ -33,6 +33,7 @@
*/
#include <sys/types.h>
+#include <pwd.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <netinet/in.h>
@@ -70,6 +71,8 @@
int foo;
int fd;
struct sockaddr_un myhost;
+ struct passwd *pw;
+ char *logname;
fd = socket(PF_UNIX, SOCK_STREAM, 0);
if (fd < 0) {
@@ -89,6 +92,13 @@
chmod(path, S_IRUSR|S_IWUSR);
+ logname = getenv("LOGNAME");
+ if(logname) {
+ pw = getpwnam(logname);
+ if(pw)
+ chown(path, pw->pw_uid, -1);
+ }
+
foo = listen(fd, 5);
if (foo == -1) {
perror("failed in listen()");
More information about the Uim-commit
mailing list