From cbf5f47c32a269e21904e2b0eb13a34545133361 Mon Sep 17 00:00:00 2001 From: Karl Heuer Date: Wed, 3 Jan 1996 04:23:26 +0000 Subject: [PATCH] (main): Do chmod based on existing permission. --- lib-src/emacsserver.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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.. */ -- 2.39.2