| Index: runtime/bin/file_android.cc
|
| diff --git a/runtime/bin/file_android.cc b/runtime/bin/file_android.cc
|
| index bdb8ac1a0a3f85cd97c5b9be18d2cb5d41a6bc72..92ddee08433841f8070dfa60f95a85c552dafdbb 100644
|
| --- a/runtime/bin/file_android.cc
|
| +++ b/runtime/bin/file_android.cc
|
| @@ -192,6 +192,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] == '/');
|
| }
|
|
|