summaryrefslogtreecommitdiffstats
path: root/base/base_paths_linux.cc
diff options
context:
space:
mode:
Diffstat (limited to 'base/base_paths_linux.cc')
-rw-r--r--base/base_paths_linux.cc8
1 files changed, 3 insertions, 5 deletions
diff --git a/base/base_paths_linux.cc b/base/base_paths_linux.cc
index 24f86b4..bdf540c 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 };