ut.ut_type = USER_PROCESS;
ut.ut_pid = getpid ();
if (xdisplay)
- {
- strncpy (ut.ut_line, xdisplay, sizeof (ut.ut_line));
strncpy (ut.ut_id, xdisplay, sizeof (ut.ut_id));
- }
- else if (tty)
+ if (tty && g_str_has_prefix (tty, "/dev/"))
strncpy (ut.ut_line, tty + strlen ("/dev/"), sizeof (ut.ut_line));
strncpy (ut.ut_user, username, sizeof (ut.ut_user));
if (xdisplay)
ut.ut_type = USER_PROCESS;
ut.ut_pid = child_pid;
if (xdisplay)
- {
- strncpy (ut.ut_line, xdisplay, sizeof (ut.ut_line));
strncpy (ut.ut_id, xdisplay, sizeof (ut.ut_id));
- }
- else if (tty)
+ if (tty && g_str_has_prefix (tty, "/dev/"))
strncpy (ut.ut_line, tty + strlen ("/dev/"), sizeof (ut.ut_line));
strncpy (ut.ut_user, username, sizeof (ut.ut_user));
if (xdisplay)
ut.ut_type = DEAD_PROCESS;
ut.ut_pid = child_pid;
if (xdisplay)
- {
- strncpy (ut.ut_line, xdisplay, sizeof (ut.ut_line));
strncpy (ut.ut_id, xdisplay, sizeof (ut.ut_id));
- }
- else if (tty)
+ if (tty && g_str_has_prefix (tty, "/dev/"))
strncpy (ut.ut_line, tty + strlen ("/dev/"), sizeof (ut.ut_line));
strncpy (ut.ut_user, username, sizeof (ut.ut_user));
if (xdisplay)