From 4460388e76648d908b71f3f5ea46d8ce2af39234 Mon Sep 17 00:00:00 2001 From: Alexander Monakov Date: Mon, 17 Jun 2013 20:36:06 +0400 Subject: [PATCH] egltrace/android: Fix tracing Zygote processes The root cause of the problem was a bug in the implementation of getZygoteProcessName. When the wrap.$procname approach is used, reading /proc/cmdline produces "$procname\0/system/bin\0--application\0"... (with embedded zero characters). Fixed by simply not supplying length argument to the truncate call, which will truncate to strlen(). The same bug is also present in getProcessName. --- wrappers/trace.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wrappers/trace.cpp b/wrappers/trace.cpp index d79b11b..33b5cf1 100644 --- a/wrappers/trace.cpp +++ b/wrappers/trace.cpp @@ -70,7 +70,7 @@ getZygoteProcessName(void) assert(fd >= 0); len = read(fd, buf, size - 1); close(fd); - path.truncate(len); + path.truncate(); return path; } -- 2.43.0