summaryrefslogtreecommitdiffstats
path: root/ipc
diff options
context:
space:
mode:
authorthakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-16 18:26:02 +0000
committerthakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-16 18:26:02 +0000
commita29502632b8f8b8663103ca5e1a01d94f4cdcd64 (patch)
treead1421c72cd16571127fbc6f3a5b42f80b87d703 /ipc
parentdc521e9a112f4744883183f733cb4eee45bb11c3 (diff)
downloadchromium_src-a29502632b8f8b8663103ca5e1a01d94f4cdcd64.zip
chromium_src-a29502632b8f8b8663103ca5e1a01d94f4cdcd64.tar.gz
chromium_src-a29502632b8f8b8663103ca5e1a01d94f4cdcd64.tar.bz2
ipc
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@49988 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ipc')
-rw-r--r--ipc/ipc_channel_posix.cc48
1 files changed, 32 insertions, 16 deletions
diff --git a/ipc/ipc_channel_posix.cc b/ipc/ipc_channel_posix.cc
index 7c599ab..2fc1a18 100644
--- a/ipc/ipc_channel_posix.cc
+++ b/ipc/ipc_channel_posix.cc
@@ -93,7 +93,8 @@ class PipeMap {
ChannelToFDMap::iterator i = map_.find(channel_id);
if (i != map_.end()) {
- HANDLE_EINTR(close(i->second));
+ if (HANDLE_EINTR(close(i->second)) < 0)
+ PLOG(ERROR) << "close";
map_.erase(i);
}
}
@@ -155,7 +156,8 @@ bool CreateServerFifo(const std::string& pipe_name, int* server_listen_fd) {
// Make socket non-blocking
if (fcntl(fd, F_SETFL, O_NONBLOCK) == -1) {
- HANDLE_EINTR(close(fd));
+ if (HANDLE_EINTR(close(fd)) < 0)
+ PLOG(ERROR) << "close";
return false;
}
@@ -173,14 +175,16 @@ 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) {
- HANDLE_EINTR(close(fd));
+ if (HANDLE_EINTR(close(fd)) < 0)
+ PLOG(ERROR) << "close";
return false;
}
// Start listening on the socket.
const int listen_queue_length = 1;
if (listen(fd, listen_queue_length) != 0) {
- HANDLE_EINTR(close(fd));
+ if (HANDLE_EINTR(close(fd)) < 0)
+ PLOG(ERROR) << "close";
return false;
}
@@ -218,7 +222,8 @@ 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";
- HANDLE_EINTR(close(fd));
+ if (HANDLE_EINTR(close(fd)) < 0)
+ PLOG(ERROR) << "close";
return false;
}
@@ -233,7 +238,8 @@ 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) {
- HANDLE_EINTR(close(fd));
+ if (HANDLE_EINTR(close(fd)) < 0)
+ PLOG(ERROR) << "close";
return false;
}
@@ -315,8 +321,10 @@ 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)";
- HANDLE_EINTR(close(pipe_fds[0]));
- HANDLE_EINTR(close(pipe_fds[1]));
+ if (HANDLE_EINTR(close(pipe_fds[0])) < 0)
+ PLOG(ERROR) << "close";
+ if (HANDLE_EINTR(close(pipe_fds[1])) < 0)
+ PLOG(ERROR) << "close";
return false;
}
@@ -534,7 +542,8 @@ bool Channel::ChannelImpl::ProcessIncomingMessages() {
<< " cmsg_len:" << cmsg->cmsg_len
<< " fd:" << pipe_;
for (unsigned i = 0; i < num_wire_fds; ++i)
- HANDLE_EINTR(close(wire_fds[i]));
+ if (HANDLE_EINTR(close(wire_fds[i])) < 0)
+ PLOG(ERROR) << "close" << i;
return false;
}
break;
@@ -614,7 +623,8 @@ bool Channel::ChannelImpl::ProcessIncomingMessages() {
<< " cmsg_len:" << cmsg->cmsg_len
<< " fd:" << pipe_;
for (unsigned i = 0; i < num_wire_fds; ++i)
- HANDLE_EINTR(close(wire_fds[i]));
+ if (HANDLE_EINTR(close(wire_fds[i])) < 0)
+ PLOG(ERROR) << "close" << i;
return false;
}
break;
@@ -660,7 +670,8 @@ 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)
- HANDLE_EINTR(close(fds[i]));
+ if (HANDLE_EINTR(close(fds[i])) < 0)
+ PLOG(ERROR) << "close" << i;
input_overflow_fds_.clear();
// abort the connection
return false;
@@ -993,7 +1004,8 @@ void Channel::ChannelImpl::Close() {
server_listen_connection_watcher_.StopWatchingFileDescriptor();
if (server_listen_pipe_ != -1) {
- HANDLE_EINTR(close(server_listen_pipe_));
+ if (HANDLE_EINTR(close(server_listen_pipe_)) < 0)
+ PLOG(ERROR) << "close";
server_listen_pipe_ = -1;
}
@@ -1001,7 +1013,8 @@ void Channel::ChannelImpl::Close() {
read_watcher_.StopWatchingFileDescriptor();
write_watcher_.StopWatchingFileDescriptor();
if (pipe_ != -1) {
- HANDLE_EINTR(close(pipe_));
+ if (HANDLE_EINTR(close(pipe_)) < 0)
+ PLOG(ERROR) << "close";
pipe_ = -1;
}
if (client_pipe_ != -1) {
@@ -1010,11 +1023,13 @@ void Channel::ChannelImpl::Close() {
}
#if !defined(OS_MACOSX)
if (fd_pipe_ != -1) {
- HANDLE_EINTR(close(fd_pipe_));
+ if (HANDLE_EINTR(close(fd_pipe_)) < 0)
+ PLOG(ERROR) << "close";
fd_pipe_ = -1;
}
if (remote_fd_pipe_ != -1) {
- HANDLE_EINTR(close(remote_fd_pipe_));
+ if (HANDLE_EINTR(close(remote_fd_pipe_)) < 0)
+ PLOG(ERROR) << "close";
remote_fd_pipe_ = -1;
}
#endif
@@ -1033,7 +1048,8 @@ 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) {
- HANDLE_EINTR(close(*i));
+ if (HANDLE_EINTR(close(*i)) < 0)
+ PLOG(ERROR) << "close";
}
input_overflow_fds_.clear();
}