diff options
| author | Richard M. Stallman | 1994-12-07 07:38:00 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1994-12-07 07:38:00 +0000 |
| commit | 021eac48bf914e3f1995c6170d8a15b38d000972 (patch) | |
| tree | 2ff1a5e9d2074b61d9216aac1582ff1173618d42 /lib-src | |
| parent | c37e488971321c8e44d4716afbf8c79f7cb654e8 (diff) | |
| download | emacs-021eac48bf914e3f1995c6170d8a15b38d000972.tar.gz emacs-021eac48bf914e3f1995c6170d8a15b38d000972.zip | |
[HAVE_SYSVIPC]: Include sys/utsname.h.
(main): If socket/mqueue name is in home dir, add in the host name.
Rename .emacs_server to .emacs-server-....
Diffstat (limited to 'lib-src')
| -rw-r--r-- | lib-src/emacsserver.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/lib-src/emacsserver.c b/lib-src/emacsserver.c index 1017639bda2..b7b948e7fd6 100644 --- a/lib-src/emacsserver.c +++ b/lib-src/emacsserver.c | |||
| @@ -33,7 +33,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ | |||
| 33 | #undef signal | 33 | #undef signal |
| 34 | 34 | ||
| 35 | 35 | ||
| 36 | #if !defined(HAVE_SOCKETS) && !defined(HAVE_SYSVIPC) | 36 | #if !defined (HAVE_SOCKETS) && !defined (HAVE_SYSVIPC) |
| 37 | #include <stdio.h> | 37 | #include <stdio.h> |
| 38 | 38 | ||
| 39 | main () | 39 | main () |
| @@ -126,7 +126,9 @@ main () | |||
| 126 | exit (1); | 126 | exit (1); |
| 127 | } | 127 | } |
| 128 | strcpy (server.sun_path, homedir); | 128 | strcpy (server.sun_path, homedir); |
| 129 | strcat (server.sun_path, "/.emacs_server"); | 129 | strcat (server.sun_path, "/.emacs-server-"); |
| 130 | gethostname (system_name, sizeof (system_name)); | ||
| 131 | strcat (server.sun_path, system_name); | ||
| 130 | /* Delete anyone else's old server. */ | 132 | /* Delete anyone else's old server. */ |
| 131 | unlink (server.sun_path); | 133 | unlink (server.sun_path); |
| 132 | #endif | 134 | #endif |
| @@ -253,6 +255,9 @@ main () | |||
| 253 | #include <sys/msg.h> | 255 | #include <sys/msg.h> |
| 254 | #include <setjmp.h> | 256 | #include <setjmp.h> |
| 255 | #include <errno.h> | 257 | #include <errno.h> |
| 258 | #include <sys/utsname.h> | ||
| 259 | |||
| 260 | struct utsname system_name; | ||
| 256 | 261 | ||
| 257 | #ifndef errno | 262 | #ifndef errno |
| 258 | extern int errno; | 263 | extern int errno; |
| @@ -285,7 +290,7 @@ main () | |||
| 285 | FILE *infile; | 290 | FILE *infile; |
| 286 | 291 | ||
| 287 | /* | 292 | /* |
| 288 | * Create a message queue using ~/.emacs_server as the path for ftok | 293 | * Create a message queue using ~/.emacs-server as the path for ftok |
| 289 | */ | 294 | */ |
| 290 | if ((homedir = getenv ("HOME")) == NULL) | 295 | if ((homedir = getenv ("HOME")) == NULL) |
| 291 | { | 296 | { |
| @@ -293,7 +298,14 @@ main () | |||
| 293 | exit (1); | 298 | exit (1); |
| 294 | } | 299 | } |
| 295 | strcpy (string, homedir); | 300 | strcpy (string, homedir); |
| 296 | strcat (string, "/.emacs_server"); | 301 | #ifndef HAVE_LONG_FILE_NAMES |
| 302 | /* If file names are short, we can't fit the host name. */ | ||
| 303 | strcat (string, "/.emacs-server"); | ||
| 304 | #else | ||
| 305 | strcat (string, "/.emacs-server-"); | ||
| 306 | uname (&system_name); | ||
| 307 | strcat (string, system_name.nodename); | ||
| 308 | #endif | ||
| 297 | creat (string, 0600); | 309 | creat (string, 0600); |
| 298 | key = ftok (string, 1); /* unlikely to be anyone else using it */ | 310 | key = ftok (string, 1); /* unlikely to be anyone else using it */ |
| 299 | s = msgget (key, 0600 | IPC_CREAT); | 311 | s = msgget (key, 0600 | IPC_CREAT); |