Bug 919076 - Minimum set of changes to enable group and world readable files depending on umask. r=paolo
authorMonica Chew <mmc@mozilla.com>
Wed, 27 Nov 2013 11:34:09 -0800
changeset 168017 d62e92066e8710303e142740d9818a064006f84f
parent 168016 3b6eb557374c83636401ec747118619fff7c6f64
child 168018 70141743e2fa77cc580ab58f37d7072f32461655
push id4703
push userakeybl@mozilla.com
push dateMon, 09 Dec 2013 20:24:19 +0000
treeherdermozilla-aurora@20af7fbd96c1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspaolo
bugs919076
milestone28.0a1
Bug 919076 - Minimum set of changes to enable group and world readable files depending on umask. r=paolo
netwerk/base/src/BackgroundFileSaver.cpp
uriloader/exthandler/nsExternalHelperAppService.cpp
--- 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);
     }