From 08ba4beebb6c2f609272837b8b4329cfc81418e3 Mon Sep 17 00:00:00 2001 From: Robert Ancell Date: Mon, 23 Jul 2012 17:28:25 +1200 Subject: Set utmp ut_host field to the X display address --- src/session-child.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/session-child.c b/src/session-child.c index 07525302..628d8faf 100644 --- a/src/session-child.c +++ b/src/session-child.c @@ -540,7 +540,9 @@ session_child_run (int argc, char **argv) strncpy (ut.ut_line, tty + strlen ("/dev/"), sizeof (ut.ut_line)); strncpy (ut.ut_id, xdisplay, sizeof (ut.ut_id)); strncpy (ut.ut_user, username, sizeof (ut.ut_user)); - if (remote_host_name) + if (xdisplay) + strncpy (ut.ut_host, xdisplay, sizeof (ut.ut_host)); + else if (remote_host_name) strncpy (ut.ut_host, remote_host_name, sizeof (ut.ut_host)); gettimeofday (&tv, NULL); ut.ut_tv.tv_sec = tv.tv_sec; @@ -567,7 +569,9 @@ session_child_run (int argc, char **argv) strncpy (ut.ut_line, tty + strlen ("/dev/"), sizeof (ut.ut_line)); strncpy (ut.ut_id, xdisplay, sizeof (ut.ut_id)); strncpy (ut.ut_user, username, sizeof (ut.ut_user)); - if (remote_host_name) + if (xdisplay) + strncpy (ut.ut_host, xdisplay, sizeof (ut.ut_host)); + else if (remote_host_name) strncpy (ut.ut_host, remote_host_name, sizeof (ut.ut_host)); gettimeofday (&tv, NULL); ut.ut_tv.tv_sec = tv.tv_sec; -- cgit v1.2.1