#undef signal
-#if !defined(HAVE_SOCKETS) && !defined(HAVE_SYSVIPC)
+#if !defined (HAVE_SOCKETS) && !defined (HAVE_SYSVIPC)
#include <stdio.h>
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);
}
}
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)
#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;
}
/*
- * 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)
{
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);