Bug 799686 - Make about:memory dump file readable on Android. r=njn

This commit is contained in:
Kartikaya Gupta 2012-10-13 08:54:49 -04:00
parent 28839d5de3
commit 0e35c8beb2

View File

@ -38,6 +38,11 @@
#include <fcntl.h>
#endif
#ifdef ANDROID
#include <sys/types.h>
#include <sys/stat.h>
#endif
using namespace mozilla;
using namespace mozilla::dom;
@ -1308,7 +1313,15 @@ nsMemoryReporterManager::DumpMemoryReportsToFileImpl(
rv = tmpFile->AppendNative(NS_LITERAL_CSTRING("incomplete-") + filename);
NS_ENSURE_SUCCESS(rv, rv);
rv = tmpFile->CreateUnique(nsIFile::NORMAL_FILE_TYPE, 0600);
#ifdef ANDROID
// Set umask to 0 while we create the file because on Android the default
// umask is 0077.
mode_t mask = umask(0);
#endif
rv = tmpFile->CreateUnique(nsIFile::NORMAL_FILE_TYPE, 0644);
#ifdef ANDROID
umask(mask);
#endif
NS_ENSURE_SUCCESS(rv, rv);
nsRefPtr<nsGZFileWriter> writer = new nsGZFileWriter();