comparison lib-src/emacsclient.c @ 83030:895e130cc8da

Merged in changes from CVS HEAD Patches applied: * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-53 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-54 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-55 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-56 Update from CVS git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-70
author Karoly Lorentey <lorentey@elte.hu>
date Mon, 26 Jan 2004 21:22:42 +0000
parents c66ebcc29777 04e9ebd16fcd
children 1d2f73785d9d
comparison
equal deleted inserted replaced
83029:f002bd19cc34 83030:895e130cc8da
471 our euid. If so, look for a socket based on the UID 471 our euid. If so, look for a socket based on the UID
472 associated with the name. This is reminiscent of the logic 472 associated with the name. This is reminiscent of the logic
473 that init_editfns uses to set the global Vuser_full_name. */ 473 that init_editfns uses to set the global Vuser_full_name. */
474 474
475 char *user_name = (char *) getenv ("LOGNAME"); 475 char *user_name = (char *) getenv ("LOGNAME");
476
476 if (!user_name) 477 if (!user_name)
477 user_name = (char *) getenv ("USER"); 478 user_name = (char *) getenv ("USER");
478 479
479 if (user_name) 480 if (user_name)
480 { 481 {
481 struct passwd *pw = getpwnam (user_name); 482 struct passwd *pw = getpwnam (user_name);
483
482 if (pw && (pw->pw_uid != geteuid ())) 484 if (pw && (pw->pw_uid != geteuid ()))
483 { 485 {
484 /* We're running under su, apparently. */ 486 /* We're running under su, apparently. */
485 sprintf (socket_name, "/tmp/emacs%d-%s/server", 487 sprintf (socket_name, "/tmp/emacs%d-%s/server",
486 (int) pw->pw_uid, system_name); 488 (int) pw->pw_uid, system_name);
495 } 497 }
496 498
497 sock_status = socket_status (server.sun_path); 499 sock_status = socket_status (server.sun_path);
498 saved_errno = errno; 500 saved_errno = errno;
499 } 501 }
502 else
503 errno = saved_errno;
500 } 504 }
501 } 505 }
502 506
503 switch (sock_status) 507 switch (sock_status)
504 { 508 {