| Index: runtime/bin/directory_macos.cc
|
| diff --git a/runtime/bin/directory_macos.cc b/runtime/bin/directory_macos.cc
|
| index 59977a3886dd54334f2e220fb5cc12a5d487afb8..241fce2f9cd31ae2123d67e5c95b3897afe2bb3a 100644
|
| --- a/runtime/bin/directory_macos.cc
|
| +++ b/runtime/bin/directory_macos.cc
|
| @@ -381,12 +381,14 @@ char* Directory::Current() {
|
|
|
|
|
| bool Directory::Create(const char* dir_name) {
|
| - // If the directory already exists and is a directory do not
|
| - // attempt to create it again and treat it as a success.
|
| - if (Exists(dir_name) == EXISTS) return true;
|
| // Create the directory with the permissions specified by the
|
| // process umask.
|
| - return (TEMP_FAILURE_RETRY(mkdir(dir_name, 0777)) == 0);
|
| + int result = TEMP_FAILURE_RETRY(mkdir(dir_name, 0777));
|
| + // If the directory already exists, treat it as a success.
|
| + if (result == -1 && errno == EEXIST) {
|
| + return (Exists(dir_name) == EXISTS);
|
| + }
|
| + return (result == 0);
|
| }
|
|
|
|
|
|
|