# HG changeset patch # User Richard M. Stallman # Date 916523096 0 # Node ID 33b162fe450738bc940a96a811db0c7fb1a3a37d # Parent 676a4123361b7d675e599f59304a4e5cdc653624 (main): Eliminate arbitrary limit on diff -r 676a4123361b -r 33b162fe4507 lib-src/emacsserver.c --- a/lib-src/emacsserver.c Sat Jan 16 18:27:16 1999 +0000 +++ b/lib-src/emacsserver.c Sat Jan 16 21:44:56 1999 +0000 @@ -213,7 +213,8 @@ int argc; char **argv; { - char system_name[32]; + char *system_name; + int system_name_length; int s, infd; #ifdef SOCKLEN_TYPE SOCKLEN_TYPE fromlen; @@ -250,9 +251,22 @@ } server.sun_family = AF_UNIX; #ifndef SERVER_HOME_DIR - gethostname (system_name, sizeof (system_name)); - /* system_name must be null-terminated string */ - system_name[sizeof (system_name) - 1] = '\0'; + system_name_length = 32; + + while (1) + { + system_name = (char *) xmalloc (system_name_length + 1); + + /* system_name must be null-terminated string. */ + system_name[system_name_length] = '\0'; + + if (gethostname (system_name, system_name_length) == 0) + break; + + free (system_name); + system_name_length *= 2; + } + sprintf (server.sun_path, "/tmp/esrv%d-%s", geteuid (), system_name); if (unlink (server.sun_path) == -1 && errno != ENOENT)