summaryrefslogtreecommitdiffstats
path: root/chrome/browser/zygote_main_linux.cc
diff options
context:
space:
mode:
authorjshin@chromium.org <jshin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-24 21:51:33 +0000
committerjshin@chromium.org <jshin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-24 21:51:33 +0000
commite6acd67c05952b07e9f2bbb10f9ea5a43907392b (patch)
treeecfca154737302a19e5032d09172f8101ac06376 /chrome/browser/zygote_main_linux.cc
parent28b4f9bc980da2e69c3edcee374948bae0c5f8ac (diff)
downloadchromium_src-e6acd67c05952b07e9f2bbb10f9ea5a43907392b.zip
chromium_src-e6acd67c05952b07e9f2bbb10f9ea5a43907392b.tar.gz
chromium_src-e6acd67c05952b07e9f2bbb10f9ea5a43907392b.tar.bz2
Move setlocale() to zygote_main_linux to make sure that it's called
before the sandbox is triggered. BUG=16860 (http://crbug.com/16860 ) TEST=Run Chrome with LC_ALL=en_US.UTF-8. 1. Make sure that you don't see any warning about 'setlocale failing'. 2. Upload a file whose name contains non-ASCII characters in UTF-8 (e.g. "café.txt" or "一二.txt" ) . The filename field in a form should be populated with the name (rather than empty). Review URL: http://codereview.chromium.org/160112 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@21586 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/zygote_main_linux.cc')
-rw-r--r--chrome/browser/zygote_main_linux.cc8
1 files changed, 8 insertions, 0 deletions
diff --git a/chrome/browser/zygote_main_linux.cc b/chrome/browser/zygote_main_linux.cc
index 4da9bfe..7c50e148 100644
--- a/chrome/browser/zygote_main_linux.cc
+++ b/chrome/browser/zygote_main_linux.cc
@@ -310,6 +310,14 @@ static bool MaybeEnterChroot() {
// files and cache the results or the descriptors.
base::RandUint64();
+ // To make wcstombs/mbstowcs work in a renderer, setlocale() has to be
+ // called before the sandbox is triggered. It's possible to avoid calling
+ // setlocale() by pulling out the conversion between FilePath and
+ // WebCore String out of the renderer and using string16 in place of
+ // FilePath for IPC.
+ const char* locale = setlocale(LC_ALL, "");
+ LOG_IF(WARNING, locale == NULL) << "setlocale failed.";
+
#if defined(ARCH_CPU_X86_FAMILY)
PATCH_GLOBAL_OFFSET_TABLE(localtime, sandbox_wrapper::localtime);
PATCH_GLOBAL_OFFSET_TABLE(localtime_r, sandbox_wrapper::localtime_r);