diff options
author | Robert Ancell <robert.ancell@canonical.com> | 2012-07-23 17:28:25 +1200 |
---|---|---|
committer | Robert Ancell <robert.ancell@canonical.com> | 2012-07-23 17:28:25 +1200 |
commit | 08ba4beebb6c2f609272837b8b4329cfc81418e3 (patch) | |
tree | 673f7e9a0e54907f30b7a3c81f3f34c0c7e090aa | |
parent | ab26d648476273b1e7d98d0d2fd55e89c0dd1990 (diff) | |
download | lightdm-08ba4beebb6c2f609272837b8b4329cfc81418e3.tar.gz |
Set utmp ut_host field to the X display address
-rw-r--r-- | src/session-child.c | 8 |
1 files 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; |