Chromium Code Reviews| Index: runtime/bin/file_android.cc |
| diff --git a/runtime/bin/file_android.cc b/runtime/bin/file_android.cc |
| index e8a1fa962cce72d7691e3e81ac23b471853eb6be..01f9d8c890c4512e2ac26096888ffd9fd0938776 100644 |
| --- a/runtime/bin/file_android.cc |
| +++ b/runtime/bin/file_android.cc |
| @@ -265,10 +265,17 @@ bool File::IsAbsolutePath(const char* pathname) { |
| char* File::GetCanonicalPath(const char* pathname) { |
| char* abs_path = NULL; |
| if (pathname != NULL) { |
| + // A null second argument to realpath crashes Android. Fixed in Mar 2013, |
| + // but not in earlier releases of Android. |
| + char* resolved = reinterpret_cast<char*>(malloc(PATH_MAX)); |
| + if (resolved == NULL) return (NULL); |
|
Søren Gjesse
2013/05/28 12:05:32
Remove parentheses around NULL.
Bill Hesse
2013/05/28 12:57:50
Done.
|
| do { |
| - abs_path = realpath(pathname, NULL); |
| + abs_path = realpath(pathname, resolved); |
| } while (abs_path == NULL && errno == EINTR); |
| ASSERT(abs_path == NULL || IsAbsolutePath(abs_path)); |
| + if (abs_path != resolved) { |
| + free(resolved); |
| + } |
| } |
| return abs_path; |
| } |