summaryrefslogtreecommitdiff
path: root/lib-src/emacsclient.c
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1994-12-07 07:39:23 +0000
committerRichard M. Stallman <rms@gnu.org>1994-12-07 07:39:23 +0000
commit154a67ad254778e2391abd075b7faf380bd1fe55 (patch)
tree46b8db7d5d9d311e27bb96fc77bf503a144970f7 /lib-src/emacsclient.c
parent44c70770aff1225850d05c83a594daad5a77bf06 (diff)
downloademacs-154a67ad254778e2391abd075b7faf380bd1fe55.tar.gz
[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-.... [!HAVE_SYSVIPC] (main): Fix error message diction.
Diffstat (limited to 'lib-src/emacsclient.c')
-rw-r--r--lib-src/emacsclient.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c
index 303ad654030..2a48a5022d1 100644
--- a/lib-src/emacsclient.c
+++ b/lib-src/emacsclient.c
@@ -27,7 +27,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
#undef signal
-#if !defined(HAVE_SOCKETS) && !defined(HAVE_SYSVIPC)
+#if !defined (HAVE_SOCKETS) && !defined (HAVE_SYSVIPC)
#include <stdio.h>
main (argc, argv)
@@ -103,9 +103,9 @@ main (argc, argv)
perror ("stat");
exit (1);
}
- if (statbfr.st_uid != geteuid())
+ if (statbfr.st_uid != geteuid ())
{
- fprintf (stderr, "Illegal socket owner\n");
+ fprintf (stderr, "Invalid socket owner\n");
exit (1);
}
}
@@ -116,7 +116,9 @@ main (argc, argv)
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);
#endif
if (connect (s, (struct sockaddr *) &server, strlen (server.sun_path) + 2)
@@ -176,9 +178,11 @@ main (argc, argv)
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/msg.h>
+#include <sys/utsname.h>
#include <stdio.h>
char *getwd (), *getcwd (), *getenv ();
+struct utsname system_name;
main (argc, argv)
int argc;
@@ -206,7 +210,7 @@ main (argc, argv)
}
/*
- * 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)
{
@@ -214,7 +218,14 @@ main (argc, argv)
exit (1);
}
strcpy (buf, homedir);
- strcat (buf, "/.emacs_server");
+#ifndef HAVE_LONG_FILE_NAMES
+ /* If file names are short, we can't fit the host name. */
+ strcat (buf, "/.emacs-server");
+#else
+ strcat (buf, "/.emacs-server-");
+ uname (&system_name);
+ strcat (buf, system_name.nodename);
+#endif
creat (buf, 0600);
key = ftok (buf, 1); /* unlikely to be anyone else using it */
s = msgget (key, 0600 | IPC_CREAT);