Don't strip TTY device name to the last '/'.
We've seen this bug in other applications before: we have some applications that use strrchr(tty, '/') on the TTY device name. This isn't valid when using pts(4), because the device name will be stripped to "0" instead of "pts/0". This fixes issues with login(1) ignoring /etc/ttys and missing utmp records. Reported by: Barney Cordoba <barney_cordoba yahoo com> Reviewed by: rwatson
This commit is contained in:
parent
0324af86de
commit
95e7b94a05
@ -245,8 +245,8 @@ main(int argc, char *argv[])
|
||||
(void)snprintf(tname, sizeof(tname), "%s??", _PATH_TTY);
|
||||
ttyn = tname;
|
||||
}
|
||||
if ((tty = strrchr(ttyn, '/')) != NULL)
|
||||
++tty;
|
||||
if (strncmp(ttyn, _PATH_DEV, sizeof _PATH_DEV - 1) == 0)
|
||||
tty = ttyn + sizeof _PATH_DEV - 1;
|
||||
else
|
||||
tty = ttyn;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user