summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPirama Arumuga Nainar <pirama@google.com>2019-07-26 14:49:58 -0700
committerOliver Nguyen <olivernguyen@google.com>2020-02-03 19:05:25 +0000
commit466d7164cf077377a82c2e598613373ed9cf590b (patch)
tree4bf43e987d8faa053be84e47dde1f04074963ec4
parent0fba97d295347637e8f44cc4691a027683f5c031 (diff)
downloadextras-466d7164cf077377a82c2e598613373ed9cf590b.tar.gz
Create per-uid GCOV_PREFIX dir in the getenv wrapper
Bug: http://b/116873221 With https://reviews.llvm.org/D65245, the profile runtime assumes that the directory ${GCOV_PREFIX} is already created. Before returning from the getenv wrapper, create the per-uid ${GCOV_PREFIX}. Test: cuttlefish builds and boots with new Clang. Change-Id: I276e1a92b3cb18ee85bb4451159b131d8ebca4a2 Merged-In: I276e1a92b3cb18ee85bb4451159b131d8ebca4a2 (cherry picked from commit b00f2fc6bb862c1b41c33984830e93149efa339d)
-rw-r--r--toolchain-extras/profile-globals.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/toolchain-extras/profile-globals.c b/toolchain-extras/profile-globals.c
index 95bd46dd..309f0606 100644
--- a/toolchain-extras/profile-globals.c
+++ b/toolchain-extras/profile-globals.c
@@ -17,6 +17,7 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <sys/stat.h>
#include <sys/types.h>
// This file provides a wrapper for getenv that appends the userid (geteuid())
@@ -38,5 +39,6 @@ __attribute__((weak)) char *__wrap_getenv(const char *name) {
}
sprintf(modified_gcov_prefix, "%s/%u", __real_getenv(name), geteuid());
+ mkdir(modified_gcov_prefix, 0777);
return modified_gcov_prefix;
}