aboutsummaryrefslogtreecommitdiffstats
path: root/lib-src
diff options
context:
space:
mode:
authorKarl Heuer1996-01-03 04:23:26 +0000
committerKarl Heuer1996-01-03 04:23:26 +0000
commitcbf5f47c32a269e21904e2b0eb13a34545133361 (patch)
treee523eed7cf7fe10667f2af059fb5e205d539d8dc /lib-src
parentbb3a4574664d9dd50cd701cc9c0a6acdce7c9c5d (diff)
downloademacs-cbf5f47c32a269e21904e2b0eb13a34545133361.tar.gz
emacs-cbf5f47c32a269e21904e2b0eb13a34545133361.zip
(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 ()
54#include <sys/un.h> 54#include <sys/un.h>
55#include <stdio.h> 55#include <stdio.h>
56#include <errno.h> 56#include <errno.h>
57#include <sys/stat.h>
57 58
58extern int errno; 59extern int errno;
59 60
@@ -89,6 +90,7 @@ main ()
89 FILE *infile; 90 FILE *infile;
90 FILE **openfiles; 91 FILE **openfiles;
91 int openfiles_size; 92 int openfiles_size;
93 struct stat statbuf;
92 94
93#ifndef convex 95#ifndef convex
94 char *getenv (); 96 char *getenv ();
@@ -136,7 +138,13 @@ main ()
136 exit (1); 138 exit (1);
137 } 139 }
138 /* Only this user can send commands to this Emacs. */ 140 /* Only this user can send commands to this Emacs. */
139 chmod (server.sun_path, 0600); 141 if (stat (server.sun_path, &statbuf) < 0)
142 {
143 perror_1 ("bind");
144 exit (1);
145 }
146
147 chmod (server.sun_path, statbuf.st_mode & 0600);
140 /* 148 /*
141 * Now, just wait for everything to come in.. 149 * Now, just wait for everything to come in..
142 */ 150 */