Commit 72d7b96e authored by grt@chromium.org's avatar grt@chromium.org

Tweak PathProviderPosix's FILE_EXE and FILE_MODULE handling on FreeBSD.

BUG=none
TEST=none

Review URL: http://codereview.chromium.org/8361011

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@107134 0039d316-1c4b-4281-b951-d872f2087c98
parent 9adbb6a5
......@@ -50,13 +50,14 @@ bool PathProviderPosix(int key, FilePath* result) {
int name[] = { CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, -1 };
char bin_dir[PATH_MAX + 1];
size_t length = sizeof(bin_dir);
// Upon return, |length| is the number of bytes written to |bin_dir|
// including the string terminator.
int error = sysctl(name, 4, bin_dir, &length, NULL, 0);
if (error < 0 || length == 0 || strlen(bin_dir) == 0) {
if (error < 0 || length <= 1) {
NOTREACHED() << "Unable to resolve path.";
return false;
}
bin_dir[strlen(bin_dir)] = 0;
*result = FilePath(bin_dir);
*result = FilePath(FilePath::StringType(bin_dir, length - 1));
return true;
#elif defined(OS_SOLARIS)
char bin_dir[PATH_MAX + 1];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment