Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(182)

Unified Diff: runtime/bin/file_android.cc

Issue 15894004: dart:io | Fix a few bugs in the Android port of dart:io. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/bin/directory_android.cc ('k') | runtime/bin/socket_android.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
}
« no previous file with comments | « runtime/bin/directory_android.cc ('k') | runtime/bin/socket_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698