Chromium Code Reviews| Index: content/browser/zygote_host/zygote_host_impl_linux.cc |
| diff --git a/content/browser/zygote_host/zygote_host_impl_linux.cc b/content/browser/zygote_host/zygote_host_impl_linux.cc |
| index 044dedc9efa578aaf4a8249f0d914b99c5085bda..daae1068cf1ace9e665f6d5e04f0117e8dd34d90 100644 |
| --- a/content/browser/zygote_host/zygote_host_impl_linux.cc |
| +++ b/content/browser/zygote_host/zygote_host_impl_linux.cc |
| @@ -59,8 +59,7 @@ ZygoteHostImpl::ZygoteHostImpl() |
| sandbox_status_(0) {} |
| ZygoteHostImpl::~ZygoteHostImpl() { |
| - if (init_) |
| - close(control_fd_); |
| + TearDown(); |
| } |
| // static |
| @@ -217,6 +216,18 @@ void ZygoteHostImpl::Init(const std::string& sandbox_cmd) { |
| // We don't wait for the reply. We'll read it in ReadReply. |
| } |
| +void ZygoteHostImpl::TearDown() { |
| + if (init_) { |
| + // Closing the IPC channel will act as a notification to exit |
| + // to the Zygote. |
| + if (IGNORE_EINTR(close(control_fd_))) { |
| + PLOG(ERROR) << "Could not close Zygote control channel."; |
| + NOTREACHED(); |
| + } |
|
piman
2014/01/28 02:20:44
nit: maybe reset control_fd_ to -1 for added defen
jln (very slow on Chromium)
2014/01/28 02:52:45
Done. I hadn't done it because "init_" is checked
|
| + init_ = false; |
| + } |
| +} |
| + |
| bool ZygoteHostImpl::SendMessage(const Pickle& data, |
| const std::vector<int>* fds) { |
| CHECK(data.size() <= kZygoteMaxMessageLength) |