Chromium Code Reviews| 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) { |
|
Evan Martin
2010/11/30 21:09:30
It seems the new code loses the >PATH_MAX check.
Evan Martin
2010/11/30 21:09:30
It seems the new code loses the >PATH_MAX check.
Greg Spencer (Chromium)
2010/11/30 22:15:07
I don't think we do. If readlink is saying it cop
|
| + 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 }; |