Mercurial > emacs
changeset 13925:5baf69817438
(main): Do chmod based on existing permission.
author | Karl Heuer <kwzh@gnu.org> |
---|---|
date | Wed, 03 Jan 1996 04:23:26 +0000 |
parents | 36aa12b0ea6a |
children | 9ea670eb276d |
files | lib-src/emacsserver.c |
diffstat | 1 files changed, 9 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- 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 <sys/un.h> #include <stdio.h> #include <errno.h> +#include <sys/stat.h> 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.. */