diff options
| author | Jim Blandy | 1992-01-14 08:05:08 +0000 |
|---|---|---|
| committer | Jim Blandy | 1992-01-14 08:05:08 +0000 |
| commit | efb859b44a15047011d1687933da6a31a43cc30a (patch) | |
| tree | 5495cd790f55c8b9dbde4190c959d026e9157f15 /lib-src | |
| parent | 2798dedf7cb4bbeba6091c443dc64edf0953da18 (diff) | |
| download | emacs-efb859b44a15047011d1687933da6a31a43cc30a.tar.gz emacs-efb859b44a15047011d1687933da6a31a43cc30a.zip | |
*** empty log message ***
Diffstat (limited to 'lib-src')
| -rw-r--r-- | lib-src/emacsclient.c | 40 |
1 files changed, 19 insertions, 21 deletions
diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c index 89e90b250ff..bd2edf62993 100644 --- a/lib-src/emacsclient.c +++ b/lib-src/emacsclient.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* Client process that communicates with GNU Emacs acting as server.` | 1 | /* Client process that communicates with GNU Emacs acting as server. |
| 2 | Copyright (C) 1986, 1987 Free Software Foundation, Inc. | 2 | Copyright (C) 1986, 1987 Free Software Foundation, Inc. |
| 3 | 3 | ||
| 4 | This file is part of GNU Emacs. | 4 | This file is part of GNU Emacs. |
| @@ -49,13 +49,10 @@ main (argc, argv) | |||
| 49 | #include <sys/types.h> | 49 | #include <sys/types.h> |
| 50 | #include <sys/socket.h> | 50 | #include <sys/socket.h> |
| 51 | #include <sys/un.h> | 51 | #include <sys/un.h> |
| 52 | #include <sys/stat.h> | ||
| 52 | #include <stdio.h> | 53 | #include <stdio.h> |
| 53 | #include <errno.h> | 54 | #include <errno.h> |
| 54 | 55 | ||
| 55 | #ifndef SERVER_HOME_DIR | ||
| 56 | #include <sys/stat.h> | ||
| 57 | #endif | ||
| 58 | |||
| 59 | extern int sys_nerr; | 56 | extern int sys_nerr; |
| 60 | extern char *sys_errlist[]; | 57 | extern char *sys_errlist[]; |
| 61 | extern int errno; | 58 | extern int errno; |
| @@ -70,9 +67,6 @@ main (argc, argv) | |||
| 70 | struct sockaddr_un server; | 67 | struct sockaddr_un server; |
| 71 | char *homedir, *cwd, *str; | 68 | char *homedir, *cwd, *str; |
| 72 | char string[BUFSIZ]; | 69 | char string[BUFSIZ]; |
| 73 | #ifndef SERVER_HOME_DIR | ||
| 74 | struct stat statbfr; | ||
| 75 | #endif | ||
| 76 | 70 | ||
| 77 | char *getenv (), *getwd (); | 71 | char *getenv (), *getwd (); |
| 78 | int geteuid (); | 72 | int geteuid (); |
| @@ -95,19 +89,23 @@ main (argc, argv) | |||
| 95 | } | 89 | } |
| 96 | server.sun_family = AF_UNIX; | 90 | server.sun_family = AF_UNIX; |
| 97 | #ifndef SERVER_HOME_DIR | 91 | #ifndef SERVER_HOME_DIR |
| 98 | gethostname (system_name, sizeof (system_name)); | 92 | { |
| 99 | sprintf (server.sun_path, "/tmp/esrv%d-%s", geteuid (), system_name); | 93 | struct stat statbfr; |
| 100 | 94 | ||
| 101 | if (stat (server.sun_path, &statbfr) == -1) | 95 | gethostname (system_name, sizeof (system_name)); |
| 102 | { | 96 | sprintf (server.sun_path, "/tmp/esrv%d-%s", geteuid (), system_name); |
| 103 | perror ("stat"); | 97 | |
| 104 | exit (1); | 98 | if (stat (server.sun_path, &statbfr) == -1) |
| 105 | } | 99 | { |
| 106 | if (statbfr.st_uid != geteuid()) | 100 | perror ("stat"); |
| 107 | { | 101 | exit (1); |
| 108 | fprintf (stderr, "Illegal socket owner\n"); | 102 | } |
| 109 | exit (1); | 103 | if (statbfr.st_uid != geteuid()) |
| 110 | } | 104 | { |
| 105 | fprintf (stderr, "Illegal socket owner\n"); | ||
| 106 | exit (1); | ||
| 107 | } | ||
| 108 | } | ||
| 111 | #else | 109 | #else |
| 112 | if ((homedir = getenv ("HOME")) == NULL) | 110 | if ((homedir = getenv ("HOME")) == NULL) |
| 113 | { | 111 | { |