From af4993f6ad442816be12ad609544ac56e2ed4cee Mon Sep 17 00:00:00 2001
From: Vincent Lang <vincent@plexapp.com>
Date: Mon, 12 Oct 2015 19:24:54 +0200
Subject: [PATCH] chromium: create wakeup pipe with O_CLOEXEC

Since the sandbox thread is terminated by closing the pipe, forked
processes could keep the pipe alive for a longer time than intended,
and freeze RenderSandboxHostLinux::~RenderSandboxHostLinux().

This is all Linux-specific code, so use the glibc-specific pipe2()
function.
---
 .../content/browser/renderer_host/render_sandbox_host_linux.cc        | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/3rdparty/chromium/content/browser/renderer_host/render_sandbox_host_linux.cc b/src/3rdparty/chromium/content/browser/renderer_host/render_sandbox_host_linux.cc
index 5b26054..c7b3cdd 100644
--- a/src/3rdparty/chromium/content/browser/renderer_host/render_sandbox_host_linux.cc
+++ b/src/3rdparty/chromium/content/browser/renderer_host/render_sandbox_host_linux.cc
@@ -5,6 +5,8 @@
 #include "content/browser/renderer_host/render_sandbox_host_linux.h"
 
 #include <sys/socket.h>
+#include <fcntl.h>
+#include <unistd.h>
 
 #include "base/memory/singleton.h"
 #include "base/posix/eintr_wrapper.h"
@@ -45,7 +47,7 @@ void RenderSandboxHostLinux::Init() {
   PCHECK(0 == shutdown(browser_socket, SHUT_WR)) << "shutdown";
 
   int pipefds[2];
-  CHECK(0 == pipe(pipefds));
+  CHECK(0 == pipe2(pipefds, O_CLOEXEC));
   const int child_lifeline_fd = pipefds[0];
   childs_lifeline_fd_ = pipefds[1];
 
-- 
2.5.1

