From: Karl Heuer Date: Wed, 3 Jan 1996 04:23:26 +0000 (+0000) Subject: (main): Do chmod based on existing permission. X-Git-Tag: emacs-19.34~1935 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=cbf5f47c32a269e21904e2b0eb13a34545133361;p=emacs.git (main): Do chmod based on existing permission. --- diff --git a/lib-src/emacsserver.c b/lib-src/emacsserver.c index 726ed86441f..a15e20502c7 100644 --- a/lib-src/emacsserver.c +++ b/lib-src/emacsserver.c @@ -54,6 +54,7 @@ main () #include #include #include +#include extern int errno; @@ -89,6 +90,7 @@ main () FILE *infile; FILE **openfiles; int openfiles_size; + struct stat statbuf; #ifndef convex char *getenv (); @@ -136,7 +138,13 @@ main () 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.. */