Index: base/base_paths_linux.cc |
diff --git a/base/base_paths_linux.cc b/base/base_paths_linux.cc |
index 701b9830f6d1b5a4c74aed923361d5c2c13d6c54..3246775fc3f991a88e23ac5cddbc5d605dacc1e3 100644 |
--- a/base/base_paths_linux.cc |
+++ b/base/base_paths_linux.cc |
@@ -37,14 +37,12 @@ bool PathProviderPosix(int key, FilePath* result) { |
case base::FILE_EXE: |
case base::FILE_MODULE: { // TODO(evanm): is this correct? |
#if defined(OS_LINUX) |
- char bin_dir[PATH_MAX + 1]; |
- int bin_dir_size = readlink(kSelfExe, bin_dir, PATH_MAX); |
- if (bin_dir_size < 0 || bin_dir_size > PATH_MAX) { |
+ FilePath bin_dir; |
+ if (!file_util::ReadSymbolicLink(FilePath(kSelfExe), &bin_dir)) { |
NOTREACHED() << "Unable to resolve " << kSelfExe << "."; |
return false; |
} |
- bin_dir[bin_dir_size] = 0; |
- *result = FilePath(bin_dir); |
+ *result = bin_dir; |
return true; |
#elif defined(OS_FREEBSD) |
int name[] = { CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, -1 }; |