summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2014-07-29 18:33:06 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2014-07-25 21:16:27 +0000
commit47a123895b11702e25ea217860ad173434ebfa6c (patch)
tree5c9b225a8e7ef5b12ad4c001c84ac67242f88097
parentf6304733878628b6a003a4ea3588b9fbb5943ce5 (diff)
parentd235288553f8c0535f51dfb8f05f81e1bc01e4ed (diff)
downloadsystem_core-47a123895b11702e25ea217860ad173434ebfa6c.zip
system_core-47a123895b11702e25ea217860ad173434ebfa6c.tar.gz
system_core-47a123895b11702e25ea217860ad173434ebfa6c.tar.bz2
Merge "Fix adb "ptsname is not thread-safe; use ptsname_r instead" build break."
-rw-r--r--adb/services.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/adb/services.c b/adb/services.c
index 528585a..2c20b81 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;