This resolves an incompatibility with non-root adb.
BUG=
22803455
Change-Id: I908923e9ddc04e0ec8de0122eb79486c8b1ae03e
return 0;
}
#ifdef ANDROID
- /* Android does not have a working ttyname() */
- name = "/dev/ptmx";
+ if (ptsname_r(*ptyfd, namebuf, namebuflen)) {
+ fatal("openpty ptsname failed.");
+ close(*ptyfd);
+ *ptyfd = -1;
+ return -1;
+ }
+ return 1;
#else
name = ttyname(*ttyfd);
if (!name)
fatal("openpty returns device for which ttyname fails.");
-#endif
strlcpy(namebuf, name, namebuflen); /* possible truncation */
return 1;
+#endif
}
/* Releases the tty. Its ownership is returned to root, and permissions to 0666. */