Start using file_util symlink code, now that it's available.
In CL http://codereview.chromium.org/5349007
I added some base API for manipulating symlinks (since I needed it for some ChromeOS code and noticed that other places could use it too), and this just starts using that API.
BUG=none
TEST=Ran ui_tests, passed trybots.
Review URL: http://codereview.chromium.org/5286010
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@68181 0039d316-1c4b-4281-b951-d872f2087c98
CrOS-Libchrome-Original-Commit: 723571af3c1a86aa14a68bce2511f3dad399287f
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 @@
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 };