1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-12 09:58:36 +00:00

Fix ptsname(3) by converting it to use devname(3) to obtain the name of

a tty device instead of the legacy minor number approach.  This is known to
fix gnome-vfs' sftp module as well as kio_sftp and kdesu on -CURRENT.

Thanks to scottl for the snprintf() approach idea.

Reviewed by:	phk
Tested by:	pav
		mich
Approved by:	re (scottl)
This commit is contained in:
Joe Marcus Clarke 2005-07-07 17:48:40 +00:00
parent 2672e71736
commit a617a18a23
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=147811

View File

@ -223,9 +223,10 @@ ptsname(int fildes)
if (!ISPTM(sbuf))
errno = EINVAL;
else {
(void)sprintf(slave, _PATH_DEV PTS_PREFIX "%c%c",
PT_DEV1[minor(sbuf.st_rdev) / 32],
PT_DEV2[minor(sbuf.st_rdev) % 32]);
(void)snprintf(slave, sizeof(slave),
_PATH_DEV PTS_PREFIX "%s",
devname(sbuf.st_rdev, S_IFCHR) +
strlen(PTM_PREFIX));
retval = slave;
}
}