Note: Without this fix on Android Go device exPath gets some junk chars at the end of exPath because readlink() does not append a null byte to buf.
Bug:
79430762
Test: Tested manually by running alloc-stress on Android Go device.
Change-Id: I8e09d8c6d670b7d29e7f98c00dd8e9e9c5492169
ssize_t exPathLen = readlink("/proc/self/exe", exPath, sizeof(exPath));
bool isExPathAvailable =
exPathLen != -1 && exPathLen < static_cast<ssize_t>(sizeof(exPath));
+ if (isExPathAvailable) {
+ exPath[exPathLen] = '\0';
+ }
execl(isExPathAvailable ? exPath : exName, exName, "--worker", arg, readFdStr, writeFdStr,
use_memcg ? "1" : "0", nullptr);
ASSERT_TRUE(0);