Bug 919076 - Minimum set of changes to enable group and world readable files depending on umask. r=paolo
--- a/netwerk/base/src/BackgroundFileSaver.cpp
+++ b/netwerk/base/src/BackgroundFileSaver.cpp
@@ -556,17 +556,17 @@ BackgroundFileSaver::ProcessStateChange(
} else {
creationIoFlags = (append ? PR_APPEND : PR_TRUNCATE) | PR_CREATE_FILE;
}
// Create the target file, or append to it if we already started writing it.
nsCOMPtr<nsIOutputStream> outputStream;
rv = NS_NewLocalFileOutputStream(getter_AddRefs(outputStream),
mActualTarget,
- PR_WRONLY | creationIoFlags, 0600);
+ PR_WRONLY | creationIoFlags, 0644);
NS_ENSURE_SUCCESS(rv, rv);
outputStream = NS_BufferOutputStream(outputStream, BUFFERED_IO_SIZE);
if (!outputStream) {
return NS_ERROR_FAILURE;
}
// Wrap the output stream so that it feeds the digest context if needed.
--- a/uriloader/exthandler/nsExternalHelperAppService.cpp
+++ b/uriloader/exthandler/nsExternalHelperAppService.cpp
@@ -1458,17 +1458,17 @@ nsresult nsExternalAppHandler::SetUpTemp
// Add an additional .part to prevent the OS from running this file in the
// default application.
tempLeafName.Append(NS_LITERAL_CSTRING(".part"));
rv = mTempFile->Append(NS_ConvertUTF8toUTF16(tempLeafName));
// make this file unique!!!
NS_ENSURE_SUCCESS(rv, rv);
- rv = mTempFile->CreateUnique(nsIFile::NORMAL_FILE_TYPE, 0600);
+ rv = mTempFile->CreateUnique(nsIFile::NORMAL_FILE_TYPE, 0644);
NS_ENSURE_SUCCESS(rv, rv);
// Now save the temp leaf name, minus the ".part" bit, so we can use it later.
// This is a bit broken in the case when createUnique actually had to append
// some numbers, because then we now have a filename like foo.bar-1.part and
// we'll end up with foo.bar-1.bar as our final filename if we end up using
// this. But the other options are all bad too.... Ideally we'd have a way
// to tell createUnique to put its unique marker before the extension that
@@ -2284,17 +2284,17 @@ NS_IMETHODIMP nsExternalAppHandler::Laun
}
#ifdef XP_WIN
fileToUse->Append(mSuggestedFileName + mTempFileExtension);
#else
fileToUse->Append(mSuggestedFileName);
#endif
- nsresult rv = fileToUse->CreateUnique(nsIFile::NORMAL_FILE_TYPE, 0600);
+ nsresult rv = fileToUse->CreateUnique(nsIFile::NORMAL_FILE_TYPE, 0644);
if(NS_SUCCEEDED(rv))
{
mFinalFileDestination = do_QueryInterface(fileToUse);
// launch the progress window now that the user has picked the desired action.
rv = CreateTransfer();
if (NS_FAILED(rv)) {
Cancel(rv);
}