summaryrefslogtreecommitdiff
path: root/src/session-child.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/session-child.c')
-rw-r--r--src/session-child.c8
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;