diff options
| author | Richard M. Stallman | 1999-01-16 21:44:56 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1999-01-16 21:44:56 +0000 |
| commit | 40beb971f4015cea4252d2f1e7dfb130a8f1ae75 (patch) | |
| tree | 573fce9c8ad6fba8e2b6cea75e68ddd90fbad25f /lib-src/emacsserver.c | |
| parent | b6a98c5219d407694d3e0aef199eb0c0ee8712d8 (diff) | |
| download | emacs-40beb971f4015cea4252d2f1e7dfb130a8f1ae75.tar.gz emacs-40beb971f4015cea4252d2f1e7dfb130a8f1ae75.zip | |
(main): Eliminate arbitrary limit on
Diffstat (limited to 'lib-src/emacsserver.c')
| -rw-r--r-- | lib-src/emacsserver.c | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/lib-src/emacsserver.c b/lib-src/emacsserver.c index 00bf923bf52..b25b58f38aa 100644 --- a/lib-src/emacsserver.c +++ b/lib-src/emacsserver.c | |||
| @@ -213,7 +213,8 @@ main (argc, argv) | |||
| 213 | int argc; | 213 | int argc; |
| 214 | char **argv; | 214 | char **argv; |
| 215 | { | 215 | { |
| 216 | char system_name[32]; | 216 | char *system_name; |
| 217 | int system_name_length; | ||
| 217 | int s, infd; | 218 | int s, infd; |
| 218 | #ifdef SOCKLEN_TYPE | 219 | #ifdef SOCKLEN_TYPE |
| 219 | SOCKLEN_TYPE fromlen; | 220 | SOCKLEN_TYPE fromlen; |
| @@ -250,9 +251,22 @@ main (argc, argv) | |||
| 250 | } | 251 | } |
| 251 | server.sun_family = AF_UNIX; | 252 | server.sun_family = AF_UNIX; |
| 252 | #ifndef SERVER_HOME_DIR | 253 | #ifndef SERVER_HOME_DIR |
| 253 | gethostname (system_name, sizeof (system_name)); | 254 | system_name_length = 32; |
| 254 | /* system_name must be null-terminated string */ | 255 | |
| 255 | system_name[sizeof (system_name) - 1] = '\0'; | 256 | while (1) |
| 257 | { | ||
| 258 | system_name = (char *) xmalloc (system_name_length + 1); | ||
| 259 | |||
| 260 | /* system_name must be null-terminated string. */ | ||
| 261 | system_name[system_name_length] = '\0'; | ||
| 262 | |||
| 263 | if (gethostname (system_name, system_name_length) == 0) | ||
| 264 | break; | ||
| 265 | |||
| 266 | free (system_name); | ||
| 267 | system_name_length *= 2; | ||
| 268 | } | ||
| 269 | |||
| 256 | sprintf (server.sun_path, "/tmp/esrv%d-%s", geteuid (), system_name); | 270 | sprintf (server.sun_path, "/tmp/esrv%d-%s", geteuid (), system_name); |
| 257 | 271 | ||
| 258 | if (unlink (server.sun_path) == -1 && errno != ENOENT) | 272 | if (unlink (server.sun_path) == -1 && errno != ENOENT) |