summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2014-07-29 11:32:16 -0700
committerElliott Hughes <enh@google.com>2014-07-29 11:34:14 -0700
commita6ff5c95a3fa798d661e09aa628cd0c5e5c8608f (patch)
tree60af1960964ae521e90e13ae1db896017e8042e1
parentb0b856e2c69b594b7ba63dccaaaf0e12ac165b65 (diff)
downloadsystem_core-a6ff5c95a3fa798d661e09aa628cd0c5e5c8608f.zip
system_core-a6ff5c95a3fa798d661e09aa628cd0c5e5c8608f.tar.gz
system_core-a6ff5c95a3fa798d661e09aa628cd0c5e5c8608f.tar.bz2
Fix adb "ptsname is not thread-safe; use ptsname_r instead" build break.
(cherry picked from commit d235288553f8c0535f51dfb8f05f81e1bc01e4ed) Change-Id: I05f8160bc8c356cb8a57e2bc5677517750700456
-rw-r--r--adb/services.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/adb/services.c b/adb/services.c
index 2875ce0..e61371a 100644
--- a/adb/services.c
+++ b/adb/services.c
@@ -206,7 +206,6 @@ static int create_subproc_pty(const char *cmd, const char *arg0, const char *arg
fprintf(stderr, "error: create_subproc_pty not implemented on Win32 (%s %s %s)\n", cmd, arg0, arg1);
return -1;
#else /* !HAVE_WIN32_PROC */
- char *devname;
int ptm;
ptm = unix_open("/dev/ptmx", O_RDWR | O_CLOEXEC); // | O_NOCTTY);
@@ -215,8 +214,8 @@ static int create_subproc_pty(const char *cmd, const char *arg0, const char *arg
return -1;
}
- if(grantpt(ptm) || unlockpt(ptm) ||
- ((devname = (char*) ptsname(ptm)) == 0)){
+ char devname[64];
+ if(grantpt(ptm) || unlockpt(ptm) || ptsname_r(ptm, devname, sizeof(devname)) != 0) {
printf("[ trouble with /dev/ptmx - %s ]\n", strerror(errno));
adb_close(ptm);
return -1;