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

Unified Diff: base/base_paths_android.cc

Issue 2874703002: base: employ ReadSymbolicLink() in PathProviderAndroid() (Closed)
Patch Set: Created 3 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/base_paths_android.cc
diff --git a/base/base_paths_android.cc b/base/base_paths_android.cc
index 8a400e5bd14ae9e29c9350bafe0c10fc163604f0..0962d8456fce5611771708a66a5f1e6035f8a456 100644
--- a/base/base_paths_android.cc
+++ b/base/base_paths_android.cc
@@ -21,14 +21,12 @@ namespace base {
bool PathProviderAndroid(int key, FilePath* result) {
switch (key) {
case base::FILE_EXE: {
- char bin_dir[PATH_MAX + 1];
- int bin_dir_size = readlink(kProcSelfExe, bin_dir, PATH_MAX);
- if (bin_dir_size < 0 || bin_dir_size > PATH_MAX) {
+ FilePath bin_dir;
+ if (!ReadSymbolicLink(FilePath(kProcSelfExe), &bin_dir)) {
NOTREACHED() << "Unable to resolve " << kProcSelfExe << ".";
return false;
}
- bin_dir[bin_dir_size] = 0;
- *result = FilePath(bin_dir);
+ *result = bin_dir;
return true;
}
case base::FILE_MODULE:
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698