Allow mkdir() race to succeed.
When two zygotes are starting, they both may try creating a mount
point after checking lstat(). The second mkdir() will result in
EEXIST, which is okay to ignore.
Bug: 7165469
Change-Id: If4411e2621f773c74cd05247899982fa5ebdd020
diff --git a/libcutils/fs.c b/libcutils/fs.c
index a9889b2..1226d44 100644
--- a/libcutils/fs.c
+++ b/libcutils/fs.c
@@ -55,8 +55,10 @@
create:
if (TEMP_FAILURE_RETRY(mkdir(path, mode)) == -1) {
- ALOGE("Failed to mkdir(%s): %s", path, strerror(errno));
- return -1;
+ if (errno != EEXIST) {
+ ALOGE("Failed to mkdir(%s): %s", path, strerror(errno));
+ return -1;
+ }
}
fixup: