# HG changeset patch # User Karl Heuer # Date 820643006 0 # Node ID 5baf69817438a01b236eb13fb1c8fcade8664a49 # Parent 36aa12b0ea6a0c71ba3853ab21af93b67e99ebc7 (main): Do chmod based on existing permission. diff -r 36aa12b0ea6a -r 5baf69817438 lib-src/emacsserver.c --- a/lib-src/emacsserver.c Tue Jan 02 23:04:42 1996 +0000 +++ b/lib-src/emacsserver.c Wed Jan 03 04:23:26 1996 +0000 @@ -54,6 +54,7 @@ #include #include #include +#include extern int errno; @@ -89,6 +90,7 @@ FILE *infile; FILE **openfiles; int openfiles_size; + struct stat statbuf; #ifndef convex char *getenv (); @@ -136,7 +138,13 @@ exit (1); } /* Only this user can send commands to this Emacs. */ - chmod (server.sun_path, 0600); + if (stat (server.sun_path, &statbuf) < 0) + { + perror_1 ("bind"); + exit (1); + } + + chmod (server.sun_path, statbuf.st_mode & 0600); /* * Now, just wait for everything to come in.. */