Fix Mac build
Bug: 17000769,16875245
Change-Id: Id5ff133e0c6c56db6972a187773c7e873b7062ee
diff --git a/runtime/gc/space/image_space.cc b/runtime/gc/space/image_space.cc
index bf897b2..41c34c9 100644
--- a/runtime/gc/space/image_space.cc
+++ b/runtime/gc/space/image_space.cc
@@ -89,8 +89,6 @@
PLOG(WARNING) << "Unable to open " << cache_dir_path << " to delete it's contents";
return;
}
- int dir_fd = dirfd(cache_dir);
- CHECK_GE(dir_fd, 0);
for (struct dirent* de = readdir(cache_dir); de != nullptr; de = readdir(cache_dir)) {
const char* name = de->d_name;
@@ -105,8 +103,11 @@
}
continue;
}
- if (TEMP_FAILURE_RETRY(unlinkat(dir_fd, name, 0)) != 0) {
- PLOG(ERROR) << "Unable to unlink " << cache_dir_path << "/" << name;
+ std::string cache_file(cache_dir_path);
+ cache_file += '/';
+ cache_file += name;
+ if (TEMP_FAILURE_RETRY(unlink(cache_file.c_str())) != 0) {
+ PLOG(ERROR) << "Unable to unlink " << cache_file;
continue;
}
}