summaryrefslogtreecommitdiff
path: root/lib-src
diff options
context:
space:
mode:
authorKarl Heuer <kwzh@gnu.org>1996-01-03 04:23:26 +0000
committerKarl Heuer <kwzh@gnu.org>1996-01-03 04:23:26 +0000
commita135e86fc07353fb0d2464b69e5ec6d19d9004a9 (patch)
treedd588115bb3f062be5a7f4d086bb282211d3bee8 /lib-src
parente3abd0a303543aa32de18fdc70d65c73df8a304f (diff)
downloademacs-a135e86fc07353fb0d2464b69e5ec6d19d9004a9.tar.gz
(main): Do chmod based on existing permission.
Diffstat (limited to 'lib-src')
-rw-r--r--lib-src/emacsserver.c10
1 files changed, 9 insertions, 1 deletions
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 <sys/un.h>
#include <stdio.h>
#include <errno.h>
+#include <sys/stat.h>
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..
*/