summaryrefslogtreecommitdiffstats
path: root/WebKit/android/WebCoreSupport/WebCookieJar.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'WebKit/android/WebCoreSupport/WebCookieJar.cpp')
-rw-r--r--WebKit/android/WebCoreSupport/WebCookieJar.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/WebKit/android/WebCoreSupport/WebCookieJar.cpp b/WebKit/android/WebCoreSupport/WebCookieJar.cpp
index afa87c2..374dcd9 100644
--- a/WebKit/android/WebCoreSupport/WebCookieJar.cpp
+++ b/WebKit/android/WebCoreSupport/WebCookieJar.cpp
@@ -94,6 +94,16 @@ WebCookieJar::WebCookieJar(const std::string& databaseFilePath)
// This is needed for the page cycler. See http://b/2944150
net::CookieMonster::EnableFileScheme();
+ // Setup the permissions for the file
+ const char* cDatabasePath = databaseFilePath.c_str();
+ mode_t mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP;
+ if (access(cDatabasePath, F_OK) == 0)
+ chmod(cDatabasePath, mode);
+ else {
+ int fd = open(cDatabasePath, O_CREAT, mode);
+ if (fd >= 0)
+ close(fd);
+ }
FilePath cookiePath(databaseFilePath.c_str());
m_cookieDb = new SQLitePersistentCookieStore(cookiePath);
m_cookieStore = new net::CookieMonster(m_cookieDb.get(), 0);