diff options
| author | Jeff Sharkey <jsharkey@android.com> | 2012-09-25 11:10:16 -0700 |
|---|---|---|
| committer | Jeff Sharkey <jsharkey@android.com> | 2012-09-25 13:13:08 -0700 |
| commit | 489609bb44fe8834c76c772f2cff8f03dbb84e08 (patch) | |
| tree | c20a44806437059d4f65f05502e832016fe614a4 /libcutils | |
| parent | 0b76d0209981fb79350ff6b7ce25d010dddf42fa (diff) | |
| download | system_core-489609bb44fe8834c76c772f2cff8f03dbb84e08.zip system_core-489609bb44fe8834c76c772f2cff8f03dbb84e08.tar.gz system_core-489609bb44fe8834c76c772f2cff8f03dbb84e08.tar.bz2 | |
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
Diffstat (limited to 'libcutils')
| -rw-r--r-- | libcutils/fs.c | 6 |
1 files changed, 4 insertions, 2 deletions
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 @@ int fs_prepare_dir(const char* path, mode_t mode, uid_t uid, gid_t gid) { 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: |
