summaryrefslogtreecommitdiff
path: root/lib-src/emacsclient.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib-src/emacsclient.c')
-rw-r--r--lib-src/emacsclient.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c
index 49ebada768f..3ae33f72a18 100644
--- a/lib-src/emacsclient.c
+++ b/lib-src/emacsclient.c
@@ -388,12 +388,14 @@ main (argc, argv)
that init_editfns uses to set the global Vuser_full_name. */
char *user_name = (char *) getenv ("LOGNAME");
+
if (!user_name)
user_name = (char *) getenv ("USER");
if (user_name)
{
struct passwd *pw = getpwnam (user_name);
+
if (pw && (pw->pw_uid != geteuid ()))
{
/* We're running under su, apparently. */
@@ -412,6 +414,8 @@ main (argc, argv)
sock_status = socket_status (server.sun_path);
saved_errno = errno;
}
+ else
+ errno = saved_errno;
}
}