ptsname_r: support ptys returned by FreeBSD posix_openpt
[gnulib.git] / lib / ptsname_r.c
index 140a75b..145d5b1 100644 (file)
@@ -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)