mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-27 23:02:20 +00:00
Bug 1189352: Fix NSPR_LOG_FILE with absolute paths for sandboxed child on Windows. r=bbondy
This commit is contained in:
parent
e0bbfb1c32
commit
6f089c9629
@ -564,26 +564,27 @@ MaybeAddNsprLogFileAccess(std::vector<std::wstring>& aAllowedFilesReadWrite)
|
||||
return;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIFile> file;
|
||||
nsresult rv = NS_GetSpecialDirectory(NS_OS_CURRENT_WORKING_DIR,
|
||||
getter_AddRefs(file));
|
||||
if (NS_FAILED(rv) || !file) {
|
||||
NS_WARNING("Failed to get current working directory");
|
||||
return;
|
||||
}
|
||||
|
||||
nsDependentCString nsprLogFile(nsprLogFileEnv);
|
||||
rv = file->AppendRelativeNativePath(nsprLogFile);
|
||||
nsDependentCString nsprLogFilePath(nsprLogFileEnv);
|
||||
nsCOMPtr<nsIFile> nsprLogFile;
|
||||
nsresult rv = NS_NewNativeLocalFile(nsprLogFilePath, true,
|
||||
getter_AddRefs(nsprLogFile));
|
||||
if (NS_FAILED(rv)) {
|
||||
// Not a relative path, try it as an absolute one.
|
||||
rv = file->InitWithNativePath(nsprLogFile);
|
||||
// Not an absolute path, try it as a relative one.
|
||||
nsresult rv = NS_GetSpecialDirectory(NS_OS_CURRENT_WORKING_DIR,
|
||||
getter_AddRefs(nsprLogFile));
|
||||
if (NS_FAILED(rv) || !nsprLogFile) {
|
||||
NS_WARNING("Failed to get current working directory");
|
||||
return;
|
||||
}
|
||||
|
||||
rv = nsprLogFile->AppendRelativeNativePath(nsprLogFilePath);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
nsAutoString resolvedFilePath;
|
||||
rv = file->GetPath(resolvedFilePath);
|
||||
rv = nsprLogFile->GetPath(resolvedFilePath);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user