# HG changeset patch # User Eric Blake # Date 1349275559 21600 # Node ID 99a0d94bccb1221b7797799284e931a44fbd3158 # Parent efd310032e748c4280299b3b51b96f7a17bcbb82 ptsname_r: support ptys returned by FreeBSD posix_openpt The recent change to ptsname exposed a latent bug in our ptsname_r implementation on FreeBSD 8.2 - there, posix_openpt returns a device where ttyname_r already lists it as /dev/pts/0. * lib/ptsname_r.c (__ptsname_r): Don't munge name if it already lives in /dev/pts/. diff --git a/ChangeLog b/ChangeLog --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2012-10-03 Eric Blake + + ptsname_r: support ptys returned by FreeBSD posix_openpt + * lib/ptsname_r.c (__ptsname_r): Don't munge name if it already + lives in /dev/pts/. + 2012-10-02 Eric Blake pselect: reject invalid file descriptors diff --git a/lib/ptsname_r.c b/lib/ptsname_r.c --- a/lib/ptsname_r.c +++ b/lib/ptsname_r.c @@ -177,7 +177,8 @@ return errno; } - buf[sizeof (_PATH_DEV) - 1] = 't'; + if (strncmp(buf, "/dev/pts/", strlen("/dev/pts/")) != 0) + buf[sizeof (_PATH_DEV) - 1] = 't'; #endif if (__stat (buf, &st) < 0)