comparison lib-src/emacsserver.c @ 24083:33b162fe4507

(main): Eliminate arbitrary limit on
author Richard M. Stallman <rms@gnu.org>
date Sat, 16 Jan 1999 21:44:56 +0000
parents 2a5d56cc4e41
children 740c8322ca39
comparison
equal deleted inserted replaced
24082:676a4123361b 24083:33b162fe4507
211 int 211 int
212 main (argc, argv) 212 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;
220 #else 221 #else
221 size_t fromlen; 222 size_t fromlen;
248 perror_1 ("socket"); 249 perror_1 ("socket");
249 exit (1); 250 exit (1);
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)
259 { 273 {
260 perror_1 ("unlink"); 274 perror_1 ("unlink");