Mercurial > emacs
comparison lib-src/emacsserver.c @ 25261:89be69860eeb
(main): Move the dynamic allocation of
system_name outside of the SERVER_HOME_DIR conditional.
author | Karl Heuer <kwzh@gnu.org> |
---|---|
date | Sat, 14 Aug 1999 04:08:25 +0000 |
parents | 740c8322ca39 |
children | 95f7147cb572 |
comparison
equal
deleted
inserted
replaced
25260:0c8c07d1d12f | 25261:89be69860eeb |
---|---|
248 { | 248 { |
249 perror_1 ("socket"); | 249 perror_1 ("socket"); |
250 exit (1); | 250 exit (1); |
251 } | 251 } |
252 server.sun_family = AF_UNIX; | 252 server.sun_family = AF_UNIX; |
253 #ifndef SERVER_HOME_DIR | 253 |
254 system_name_length = 32; | 254 system_name_length = 32; |
255 | |
256 while (1) | 255 while (1) |
257 { | 256 { |
258 system_name = (char *) xmalloc (system_name_length + 1); | 257 system_name = (char *) xmalloc (system_name_length + 1); |
259 | 258 |
260 /* system_name must be null-terminated string. */ | 259 /* system_name must be null-terminated string. */ |
265 | 264 |
266 free (system_name); | 265 free (system_name); |
267 system_name_length *= 2; | 266 system_name_length *= 2; |
268 } | 267 } |
269 | 268 |
269 #ifndef SERVER_HOME_DIR | |
270 sprintf (server.sun_path, "/tmp/esrv%d-%s", geteuid (), system_name); | 270 sprintf (server.sun_path, "/tmp/esrv%d-%s", geteuid (), system_name); |
271 | 271 |
272 if (unlink (server.sun_path) == -1 && errno != ENOENT) | 272 if (unlink (server.sun_path) == -1 && errno != ENOENT) |
273 { | 273 { |
274 perror_1 ("unlink"); | 274 perror_1 ("unlink"); |
278 if ((homedir = getenv ("HOME")) == NULL) | 278 if ((homedir = getenv ("HOME")) == NULL) |
279 fatal_error ("No home directory\n"); | 279 fatal_error ("No home directory\n"); |
280 | 280 |
281 strcpy (server.sun_path, homedir); | 281 strcpy (server.sun_path, homedir); |
282 strcat (server.sun_path, "/.emacs-server-"); | 282 strcat (server.sun_path, "/.emacs-server-"); |
283 gethostname (system_name, sizeof (system_name)); | |
284 strcat (server.sun_path, system_name); | 283 strcat (server.sun_path, system_name); |
285 /* Delete anyone else's old server. */ | 284 /* Delete anyone else's old server. */ |
286 unlink (server.sun_path); | 285 unlink (server.sun_path); |
287 #endif | 286 #endif |
288 | 287 |