summaryrefslogtreecommitdiffstats
path: root/ipc/ipc_channel_posix.cc
diff options
context:
space:
mode:
authorthakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-16 18:34:00 +0000
committerthakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-16 18:34:00 +0000
commit966a56a9314b79ec5d234fba47502d2b5e6f97e9 (patch)
treec0b6e9e7e1b4106b862592fe43d063393767d23a /ipc/ipc_channel_posix.cc
parentec7d5d68dca09e02c5d70bb9af741721c9ac0fa0 (diff)
downloadchromium_src-966a56a9314b79ec5d234fba47502d2b5e6f97e9.zip
chromium_src-966a56a9314b79ec5d234fba47502d2b5e6f97e9.tar.gz
chromium_src-966a56a9314b79ec5d234fba47502d2b5e6f97e9.tar.bz2
Revert 49988 - ipc
TBR=thakis@chromium.org Review URL: http://codereview.chromium.org/2855004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@49996 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ipc/ipc_channel_posix.cc')
-rw-r--r--ipc/ipc_channel_posix.cc48
1 files changed, 16 insertions, 32 deletions
diff --git a/ipc/ipc_channel_posix.cc b/ipc/ipc_channel_posix.cc
index 2fc1a18..7c599ab 100644
--- a/ipc/ipc_channel_posix.cc
+++ b/ipc/ipc_channel_posix.cc
@@ -93,8 +93,7 @@ class PipeMap {
ChannelToFDMap::iterator i = map_.find(channel_id);
if (i != map_.end()) {
- if (HANDLE_EINTR(close(i->second)) < 0)
- PLOG(ERROR) << "close";
+ HANDLE_EINTR(close(i->second));
map_.erase(i);
}
}
@@ -156,8 +155,7 @@ bool CreateServerFifo(const std::string& pipe_name, int* server_listen_fd) {
// Make socket non-blocking
if (fcntl(fd, F_SETFL, O_NONBLOCK) == -1) {
- if (HANDLE_EINTR(close(fd)) < 0)
- PLOG(ERROR) << "close";
+ HANDLE_EINTR(close(fd));
return false;
}
@@ -175,16 +173,14 @@ bool CreateServerFifo(const std::string& pipe_name, int* server_listen_fd) {
// Bind the socket.
if (bind(fd, reinterpret_cast<const sockaddr*>(&unix_addr),
unix_addr_len) != 0) {
- if (HANDLE_EINTR(close(fd)) < 0)
- PLOG(ERROR) << "close";
+ HANDLE_EINTR(close(fd));
return false;
}
// Start listening on the socket.
const int listen_queue_length = 1;
if (listen(fd, listen_queue_length) != 0) {
- if (HANDLE_EINTR(close(fd)) < 0)
- PLOG(ERROR) << "close";
+ HANDLE_EINTR(close(fd));
return false;
}
@@ -222,8 +218,7 @@ bool ClientConnectToFifo(const std::string &pipe_name, int* client_socket) {
// Make socket non-blocking
if (fcntl(fd, F_SETFL, O_NONBLOCK) == -1) {
LOG(ERROR) << "fcntl failed";
- if (HANDLE_EINTR(close(fd)) < 0)
- PLOG(ERROR) << "close";
+ HANDLE_EINTR(close(fd));
return false;
}
@@ -238,8 +233,7 @@ bool ClientConnectToFifo(const std::string &pipe_name, int* client_socket) {
if (HANDLE_EINTR(connect(fd, reinterpret_cast<sockaddr*>(&server_unix_addr),
server_unix_addr_len)) != 0) {
- if (HANDLE_EINTR(close(fd)) < 0)
- PLOG(ERROR) << "close";
+ HANDLE_EINTR(close(fd));
return false;
}
@@ -321,10 +315,8 @@ bool SocketPair(int* fd1, int* fd2) {
if (fcntl(pipe_fds[0], F_SETFL, O_NONBLOCK) == -1 ||
fcntl(pipe_fds[1], F_SETFL, O_NONBLOCK) == -1) {
PLOG(ERROR) << "fcntl(O_NONBLOCK)";
- if (HANDLE_EINTR(close(pipe_fds[0])) < 0)
- PLOG(ERROR) << "close";
- if (HANDLE_EINTR(close(pipe_fds[1])) < 0)
- PLOG(ERROR) << "close";
+ HANDLE_EINTR(close(pipe_fds[0]));
+ HANDLE_EINTR(close(pipe_fds[1]));
return false;
}
@@ -542,8 +534,7 @@ bool Channel::ChannelImpl::ProcessIncomingMessages() {
<< " cmsg_len:" << cmsg->cmsg_len
<< " fd:" << pipe_;
for (unsigned i = 0; i < num_wire_fds; ++i)
- if (HANDLE_EINTR(close(wire_fds[i])) < 0)
- PLOG(ERROR) << "close" << i;
+ HANDLE_EINTR(close(wire_fds[i]));
return false;
}
break;
@@ -623,8 +614,7 @@ bool Channel::ChannelImpl::ProcessIncomingMessages() {
<< " cmsg_len:" << cmsg->cmsg_len
<< " fd:" << pipe_;
for (unsigned i = 0; i < num_wire_fds; ++i)
- if (HANDLE_EINTR(close(wire_fds[i])) < 0)
- PLOG(ERROR) << "close" << i;
+ HANDLE_EINTR(close(wire_fds[i]));
return false;
}
break;
@@ -670,8 +660,7 @@ bool Channel::ChannelImpl::ProcessIncomingMessages() {
#endif
// close the existing file descriptors so that we don't leak them
for (unsigned i = fds_i; i < num_fds; ++i)
- if (HANDLE_EINTR(close(fds[i])) < 0)
- PLOG(ERROR) << "close" << i;
+ HANDLE_EINTR(close(fds[i]));
input_overflow_fds_.clear();
// abort the connection
return false;
@@ -1004,8 +993,7 @@ void Channel::ChannelImpl::Close() {
server_listen_connection_watcher_.StopWatchingFileDescriptor();
if (server_listen_pipe_ != -1) {
- if (HANDLE_EINTR(close(server_listen_pipe_)) < 0)
- PLOG(ERROR) << "close";
+ HANDLE_EINTR(close(server_listen_pipe_));
server_listen_pipe_ = -1;
}
@@ -1013,8 +1001,7 @@ void Channel::ChannelImpl::Close() {
read_watcher_.StopWatchingFileDescriptor();
write_watcher_.StopWatchingFileDescriptor();
if (pipe_ != -1) {
- if (HANDLE_EINTR(close(pipe_)) < 0)
- PLOG(ERROR) << "close";
+ HANDLE_EINTR(close(pipe_));
pipe_ = -1;
}
if (client_pipe_ != -1) {
@@ -1023,13 +1010,11 @@ void Channel::ChannelImpl::Close() {
}
#if !defined(OS_MACOSX)
if (fd_pipe_ != -1) {
- if (HANDLE_EINTR(close(fd_pipe_)) < 0)
- PLOG(ERROR) << "close";
+ HANDLE_EINTR(close(fd_pipe_));
fd_pipe_ = -1;
}
if (remote_fd_pipe_ != -1) {
- if (HANDLE_EINTR(close(remote_fd_pipe_)) < 0)
- PLOG(ERROR) << "close";
+ HANDLE_EINTR(close(remote_fd_pipe_));
remote_fd_pipe_ = -1;
}
#endif
@@ -1048,8 +1033,7 @@ void Channel::ChannelImpl::Close() {
// Close any outstanding, received file descriptors
for (std::vector<int>::iterator
i = input_overflow_fds_.begin(); i != input_overflow_fds_.end(); ++i) {
- if (HANDLE_EINTR(close(*i)) < 0)
- PLOG(ERROR) << "close";
+ HANDLE_EINTR(close(*i));
}
input_overflow_fds_.clear();
}