summaryrefslogtreecommitdiffstats
path: root/chrome/app
diff options
context:
space:
mode:
authorevan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-12 20:57:42 +0000
committerevan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-12 20:57:42 +0000
commita36274c62b782912c6724865b071bcc323b0e5e8 (patch)
tree0fe690bc957096924bba6af923b5de8b1cd0203f /chrome/app
parent728b689f17c7baa8216dab9320298c87fd6fa409 (diff)
downloadchromium_src-a36274c62b782912c6724865b071bcc323b0e5e8.zip
chromium_src-a36274c62b782912c6724865b071bcc323b0e5e8.tar.gz
chromium_src-a36274c62b782912c6724865b071bcc323b0e5e8.tar.bz2
posix: restore permissions on incorrectly-permissioned user data dirs.
We can remove this in a month or two. BUG=11776 TEST=Remove your ~/.config/chromium. ls -ld ~/.config/chromium should be drwx------. chmod ~/.config/chromium og+rwx and restart. It should regain the above permissions. Review URL: http://codereview.chromium.org/115257 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@15893 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/app')
-rw-r--r--chrome/app/chrome_dll_main.cc17
1 files changed, 17 insertions, 0 deletions
diff --git a/chrome/app/chrome_dll_main.cc b/chrome/app/chrome_dll_main.cc
index 7f30891..e5f5b3c 100644
--- a/chrome/app/chrome_dll_main.cc
+++ b/chrome/app/chrome_dll_main.cc
@@ -17,6 +17,9 @@
#include <new.h>
#elif defined(OS_POSIX)
#include <signal.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
#endif
#if defined(OS_LINUX)
@@ -381,6 +384,20 @@ int ChromeMain(int argc, const char** argv) {
if (!user_data_dir.empty())
CHECK(PathService::Override(chrome::DIR_USER_DATA, user_data_dir));
+#if defined(OS_POSIX)
+ // Bug 11776: we mistakenly created directories world-readable.
+ // Fix old instances of these directories manually.
+ // TODO(evanm): remove this code in a month or two.
+ if (user_data_dir.empty()) {
+ FilePath fix_dir;
+ CHECK(PathService::Get(chrome::DIR_USER_DATA, &fix_dir));
+ struct stat statbuf;
+ CHECK(stat(fix_dir.value().c_str(), &statbuf) == 0);
+ if ((statbuf.st_mode & 0077) != 0)
+ CHECK(chmod(fix_dir.value().c_str(), 0700) == 0);
+ }
+#endif
+
bool single_process =
#if defined (GOOGLE_CHROME_BUILD)
// This is an unsupported and not fully tested mode, so don't enable it for