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-23 00:37:46 +0000
committerthakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-23 00:37:46 +0000
commit70eb657d0e9575764e6d744a2fd36f7f7249c799 (patch)
treecbe69d505bf6978e1b0a70c9deb13e33c677b659 /ipc/ipc_channel_posix.cc
parent44a34186a63080c37c70bddc0ecd2c5efc9d7fab (diff)
downloadchromium_src-70eb657d0e9575764e6d744a2fd36f7f7249c799.zip
chromium_src-70eb657d0e9575764e6d744a2fd36f7f7249c799.tar.gz
chromium_src-70eb657d0e9575764e6d744a2fd36f7f7249c799.tar.bz2
Clang: Do not ignore result of HANDLE_EINTR.
Review URL: http://codereview.chromium.org/2805026 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@50556 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ipc/ipc_channel_posix.cc')
-rw-r--r--ipc/ipc_channel_posix.cc51
1 files changed, 34 insertions, 17 deletions
diff --git a/ipc/ipc_channel_posix.cc b/ipc/ipc_channel_posix.cc
index 7c599ab..6e8e2642 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;
}
@@ -196,7 +200,8 @@ bool ServerAcceptFifoConnection(int server_listen_fd, int* server_socket) {
if (accept_fd < 0)
return false;
if (fcntl(accept_fd, F_SETFL, O_NONBLOCK) == -1) {
- HANDLE_EINTR(close(accept_fd));
+ if (HANDLE_EINTR(close(accept_fd)) < 0)
+ PLOG(ERROR) << "close";
return false;
}
@@ -218,7 +223,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 +239,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 +322,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 +543,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 +624,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 +671,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 +1005,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 +1014,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 +1024,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 +1049,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();
}