mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-02-24 07:58:11 +01:00
posix: Always resolve symlinks to absolute paths
This avoids issues with mismatched paths when mixing Chromium and OS filesystem functions. See https://crbug.com/40229712.
This commit is contained in:
parent
c44aa35bfc
commit
3b98dbda79
@ -103,13 +103,28 @@ base::FilePath NormalizePath(const cef_string_t& path_str,
|
|||||||
path = path.StripTrailingSeparators();
|
path = path.StripTrailingSeparators();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!path.empty() && !path.IsAbsolute()) {
|
if (!path.empty()) {
|
||||||
LOG(ERROR) << "The " << name << " directory (" << path.value()
|
if (!path.IsAbsolute()) {
|
||||||
<< ") is not an absolute path. Defaulting to empty.";
|
LOG(ERROR) << "The " << name << " directory (" << path.value()
|
||||||
if (has_error) {
|
<< ") is not an absolute path. Defaulting to empty.";
|
||||||
*has_error = true;
|
if (has_error) {
|
||||||
|
*has_error = true;
|
||||||
|
}
|
||||||
|
return base::FilePath();
|
||||||
}
|
}
|
||||||
path = base::FilePath();
|
|
||||||
|
#if BUILDFLAG(IS_POSIX)
|
||||||
|
// Always resolve symlinks to absolute paths. This avoids issues with
|
||||||
|
// mismatched paths when mixing Chromium and OS filesystem functions.
|
||||||
|
// See https://crbug.com/40229712.
|
||||||
|
base::ScopedAllowBlockingForTesting allow_blocking;
|
||||||
|
const base::FilePath& resolved_path = base::MakeAbsoluteFilePath(path);
|
||||||
|
if (!resolved_path.empty()) {
|
||||||
|
return resolved_path;
|
||||||
|
} else if (errno != 0 && errno != ENOENT) {
|
||||||
|
PLOG(ERROR) << "realpath(" << path.value() << ") failed";
|
||||||
|
}
|
||||||
|
#endif // BUILDFLAG(IS_POSIX)
|
||||||
}
|
}
|
||||||
|
|
||||||
return path;
|
return path;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user