| Index: runtime/bin/directory_macos.cc
|
| diff --git a/runtime/bin/directory_macos.cc b/runtime/bin/directory_macos.cc
|
| index c59555a431238dcf181773d6caa9cc2c283f22d7..b1ba2d9fa6b98e9485d2f644f857d95c33fc753b 100644
|
| --- a/runtime/bin/directory_macos.cc
|
| +++ b/runtime/bin/directory_macos.cc
|
| @@ -221,7 +221,7 @@ static bool ListRecursively(PathBuffer* path,
|
|
|
| static bool DeleteFile(char* file_name,
|
| PathBuffer* path) {
|
| - return path->Add(file_name) && remove(path->data) == 0;
|
| + return path->Add(file_name) && unlink(path->data) == 0;
|
| }
|
|
|
|
|
| @@ -235,15 +235,12 @@ static bool DeleteDir(char* dir_name,
|
|
|
| static bool DeleteRecursively(PathBuffer* path) {
|
| // Do not recurse into links for deletion. Instead delete the link.
|
| + // If it's a file, delete it.
|
| struct stat st;
|
| if (TEMP_FAILURE_RETRY(lstat(path->data, &st)) == -1) {
|
| return false;
|
| - } else if (S_ISLNK(st.st_mode)) {
|
| - if (TEMP_FAILURE_RETRY(stat(path->data, &st)) == -1) {
|
| - return false;
|
| - } else if (S_ISDIR(st.st_mode)) {
|
| - return (unlink(path->data) == 0);
|
| - }
|
| + } else if (S_ISREG(st.st_mode) || S_ISLNK(st.st_mode)) {
|
| + return (unlink(path->data) == 0);
|
| }
|
|
|
| if (!path->Add(File::PathSeparator())) return false;
|
|
|