[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] ptsname_r: support ptys returned by FreeBSD posix_openpt
From: |
Eric Blake |
Subject: |
[PATCH] ptsname_r: support ptys returned by FreeBSD posix_openpt |
Date: |
Wed, 3 Oct 2012 08:53:01 -0600 |
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. While
test-ptsname_r does not catch it, test-posix_openpt did.
* lib/ptsname_r.c (__ptsname_r): Don't munge name if it already
lives in /dev/pts/.
---
ChangeLog | 6 ++++++
lib/ptsname_r.c | 3 ++-
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/ChangeLog b/ChangeLog
index 70fd406..a83aa5e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2012-10-03 Eric Blake <address@hidden>
+
+ 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 <address@hidden>
pselect: reject invalid file descriptors
diff --git a/lib/ptsname_r.c b/lib/ptsname_r.c
index 140a75b..145d5b1 100644
--- a/lib/ptsname_r.c
+++ b/lib/ptsname_r.c
@@ -177,7 +177,8 @@ __ptsname_r (int fd, char *buf, size_t buflen)
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)
--
1.7.11.4
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [PATCH] ptsname_r: support ptys returned by FreeBSD posix_openpt,
Eric Blake <=