Fix Mac build

Bug: 17000769,16875245

(cherry picked from commit debdda0262bfbcb966a89e693d933cc74eb412ac)

Change-Id: I158f090c89587f176813a15e9edad917bd134cd0
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;
     }
   }