From 87f8ce656196b6e6e2cd87e379891128b45b2174 Mon Sep 17 00:00:00 2001 From: "agl@chromium.org" Date: Fri, 10 Jul 2009 19:14:31 +0000 Subject: Linux: don't bother passing the chroot directory fd to the zygote. Markus pointed out that the cwd was already shared between the chroot helper process and the zygote, therefore we could avoid some complexity in passing the file descriptor so, also, we could then make the directory mode 0000. http://codereview.chromium.org/155366 BUG=16363 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@20398 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/zygote_main_linux.cc | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) (limited to 'chrome/browser/zygote_main_linux.cc') diff --git a/chrome/browser/zygote_main_linux.cc b/chrome/browser/zygote_main_linux.cc index 9b8ef98..08f730e 100644 --- a/chrome/browser/zygote_main_linux.cc +++ b/chrome/browser/zygote_main_linux.cc @@ -221,29 +221,15 @@ static bool MaybeEnterChroot() { } char reply; - std::vector fds; - if (!base::RecvMsg(fd, &reply, 1, &fds)) { + if (HANDLE_EINTR(read(fd, &reply, 1)) != 1) { LOG(ERROR) << "Failed to read from chroot pipe: " << errno; return false; } + if (reply != kChrootMeSuccess) { LOG(ERROR) << "Error code reply from chroot helper"; - for (size_t i = 0; i < fds.size(); ++i) - HANDLE_EINTR(close(fds[i])); - return false; - } - if (fds.size() != 1) { - LOG(ERROR) << "Bad number of file descriptors from chroot helper"; - for (size_t i = 0; i < fds.size(); ++i) - HANDLE_EINTR(close(fds[i])); - return false; - } - if (fchdir(fds[0]) == -1) { - LOG(ERROR) << "Failed to chdir to root directory: " << errno; - HANDLE_EINTR(close(fds[0])); return false; } - HANDLE_EINTR(close(fds[0])); static const int kMagicSandboxIPCDescriptor = 5; SkiaFontConfigUseIPCImplementation(kMagicSandboxIPCDescriptor); -- cgit v1.1