# HG changeset patch # User Richard M. Stallman # Date 786785880 0 # Node ID bb3d25f73eaf3ccd291e044173bbf2011054e78a # Parent 3de6776ae141a12a3414e4438ef41d28d3da348b [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-.... diff -r 3de6776ae141 -r bb3d25f73eaf lib-src/emacsserver.c --- a/lib-src/emacsserver.c Tue Dec 06 08:49:44 1994 +0000 +++ b/lib-src/emacsserver.c Wed Dec 07 07:38:00 1994 +0000 @@ -33,7 +33,7 @@ #undef signal -#if !defined(HAVE_SOCKETS) && !defined(HAVE_SYSVIPC) +#if !defined (HAVE_SOCKETS) && !defined (HAVE_SYSVIPC) #include main () @@ -126,7 +126,9 @@ exit (1); } strcpy (server.sun_path, homedir); - strcat (server.sun_path, "/.emacs_server"); + strcat (server.sun_path, "/.emacs-server-"); + gethostname (system_name, sizeof (system_name)); + strcat (server.sun_path, system_name); /* Delete anyone else's old server. */ unlink (server.sun_path); #endif @@ -253,6 +255,9 @@ #include #include #include +#include + +struct utsname system_name; #ifndef errno extern int errno; @@ -285,7 +290,7 @@ FILE *infile; /* - * Create a message queue using ~/.emacs_server as the path for ftok + * Create a message queue using ~/.emacs-server as the path for ftok */ if ((homedir = getenv ("HOME")) == NULL) { @@ -293,7 +298,14 @@ exit (1); } strcpy (string, homedir); - strcat (string, "/.emacs_server"); +#ifndef HAVE_LONG_FILE_NAMES + /* If file names are short, we can't fit the host name. */ + strcat (string, "/.emacs-server"); +#else + strcat (string, "/.emacs-server-"); + uname (&system_name); + strcat (string, system_name.nodename); +#endif creat (string, 0600); key = ftok (string, 1); /* unlikely to be anyone else using it */ s = msgget (key, 0600 | IPC_CREAT);