mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-02 08:42:48 +00:00
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
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=190474
@ -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