| Index: runtime/bin/file_macos.cc
|
| diff --git a/runtime/bin/file_macos.cc b/runtime/bin/file_macos.cc
|
| index 9d324579344f92817c82285914032a9fd362986e..67869e3124591f27a0d97f9bbd5dbf7b9177552d 100644
|
| --- a/runtime/bin/file_macos.cc
|
| +++ b/runtime/bin/file_macos.cc
|
| @@ -195,6 +195,25 @@ time_t File::LastModified(const char* name) {
|
| }
|
|
|
|
|
| +char* File::LinkTarget(const char* pathname) {
|
| + struct stat link_stats;
|
| + if (lstat(pathname, &link_stats) != 0) return NULL;
|
| + if (!S_ISLNK(link_stats.st_mode)) {
|
| + errno = ENOENT;
|
| + return NULL;
|
| + }
|
| + size_t target_size = link_stats.st_size;
|
| + char* target_name = reinterpret_cast<char*>(malloc(target_size + 1));
|
| + size_t read_size = readlink(pathname, target_name, target_size + 1);
|
| + if (read_size != target_size) {
|
| + free(target_name);
|
| + return NULL;
|
| + }
|
| + target_name[target_size] = '\0';
|
| + return target_name;
|
| +}
|
| +
|
| +
|
| bool File::IsAbsolutePath(const char* pathname) {
|
| return (pathname != NULL && pathname[0] == '/');
|
| }
|
|
|