diff options
author | Jim Blandy <jimb@redhat.com> | 1991-12-21 07:03:14 +0000 |
---|---|---|
committer | Jim Blandy <jimb@redhat.com> | 1991-12-21 07:03:14 +0000 |
commit | ba8bd1542e952d6dd78098860f46324e6c3f1cc2 (patch) | |
tree | af77d8d4e6e529f9535a5e1830fcd97ff940e6c9 /lib-src | |
parent | b675743b251505d7ab12dcb359a96a60faa33c9c (diff) | |
download | emacs-ba8bd1542e952d6dd78098860f46324e6c3f1cc2.tar.gz |
*** empty log message ***
Diffstat (limited to 'lib-src')
-rw-r--r-- | lib-src/emacsserver.c | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/lib-src/emacsserver.c b/lib-src/emacsserver.c index 19e4e430ab3..e65e3e97831 100644 --- a/lib-src/emacsserver.c +++ b/lib-src/emacsserver.c @@ -59,6 +59,7 @@ extern int errno; main () { + char system_name[32]; int s, infd, fromlen; struct sockaddr_un server, fromunix; char *homedir; @@ -85,21 +86,27 @@ main () exit (1); } server.sun_family = AF_UNIX; - homedir = getenv ("HOME"); - if (homedir == NULL) +#ifndef SERVER_HOME_DIR + gethostname (system_name, sizeof (system_name)); + sprintf (server.sun_path, "/tmp/esrv%d-%s", geteuid (), system_name); + + if (unlink (server.sun_path) == -1 && errno != ENOENT) + { + perror ("unlink"); + exit (1); + } +#else + if ((homedir = getenv ("HOME")) == NULL) { fprintf (stderr,"No home directory\n"); exit (1); } - sprintf (server.sun_path, "/tmp/esrv%d", geteuid ()); - -#if 0 strcpy (server.sun_path, homedir); strcat (server.sun_path, "/.emacs_server"); -#endif - /* Delete anyone else's old server. */ unlink (server.sun_path); +#endif + if (bind (s, &server, strlen (server.sun_path) + 2) < 0) { perror ("bind"); @@ -294,6 +301,7 @@ main () if ((fromlen = msgrcv (s, msgp, BUFSIZ - 1, 1, 0)) < 0) { perror ("msgrcv"); + exit (1); } else { |