From d235288553f8c0535f51dfb8f05f81e1bc01e4ed Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Tue, 29 Jul 2014 11:32:16 -0700 Subject: Fix adb "ptsname is not thread-safe; use ptsname_r instead" build break. Change-Id: I633dc4d6d421862473e7267cc0d2c1b0933392e0 --- adb/services.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'adb/services.c') 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; -- cgit v1.1