summaryrefslogtreecommitdiffstats
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
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
-rw-r--r--app/surface/transport_dib_mac.cc4
-rw-r--r--base/file_util.h4
-rw-r--r--base/message_loop_unittest.cc12
-rw-r--r--base/message_pump_libevent.cc12
-rw-r--r--chrome/browser/renderer_host/render_widget_helper.cc6
-rw-r--r--ipc/file_descriptor_set_posix.cc6
-rw-r--r--ipc/ipc_channel_posix.cc51
-rw-r--r--net/socket/tcp_client_socket_libevent.cc3
8 files changed, 66 insertions, 32 deletions
diff --git a/app/surface/transport_dib_mac.cc b/app/surface/transport_dib_mac.cc
index ef1d242..f17835f 100644
--- a/app/surface/transport_dib_mac.cc
+++ b/app/surface/transport_dib_mac.cc
@@ -8,6 +8,7 @@
#include <sys/stat.h>
#include "base/eintr_wrapper.h"
+#include "base/logging.h"
#include "base/scoped_ptr.h"
#include "base/shared_memory.h"
#include "skia/ext/platform_canvas.h"
@@ -47,7 +48,8 @@ TransportDIB* TransportDIB::Map(TransportDIB::Handle handle) {
if ((fstat(handle.fd, &st) != 0) ||
(!dib->shared_memory_.Map(st.st_size))) {
delete dib;
- HANDLE_EINTR(close(handle.fd));
+ if (HANDLE_EINTR(close(handle.fd)) < 0)
+ PLOG(ERROR) << "close";
return NULL;
}
diff --git a/base/file_util.h b/base/file_util.h
index a16c5c72..48f431f 100644
--- a/base/file_util.h
+++ b/base/file_util.h
@@ -35,6 +35,7 @@
#if defined(OS_POSIX)
#include "base/eintr_wrapper.h"
#include "base/file_descriptor_posix.h"
+#include "base/logging.h"
#endif
namespace base {
@@ -377,7 +378,8 @@ class ScopedFDClose {
public:
inline void operator()(int* x) const {
if (x && *x >= 0) {
- HANDLE_EINTR(close(*x));
+ if (HANDLE_EINTR(close(*x)) < 0)
+ PLOG(ERROR) << "close";
}
}
};
diff --git a/base/message_loop_unittest.cc b/base/message_loop_unittest.cc
index 6208e99..da0013c 100644
--- a/base/message_loop_unittest.cc
+++ b/base/message_loop_unittest.cc
@@ -1578,8 +1578,10 @@ TEST(MessageLoopTest, FileDescriptorWatcherOutlivesMessageLoop) {
// and don't run the message loop, just destroy it.
}
}
- HANDLE_EINTR(close(pipefds[0]));
- HANDLE_EINTR(close(pipefds[1]));
+ if (HANDLE_EINTR(close(pipefds[0])) < 0)
+ PLOG(ERROR) << "close";
+ if (HANDLE_EINTR(close(pipefds[1])) < 0)
+ PLOG(ERROR) << "close";
}
TEST(MessageLoopTest, FileDescriptorWatcherDoubleStop) {
@@ -1601,8 +1603,10 @@ TEST(MessageLoopTest, FileDescriptorWatcherDoubleStop) {
controller.StopWatchingFileDescriptor();
}
}
- HANDLE_EINTR(close(pipefds[0]));
- HANDLE_EINTR(close(pipefds[1]));
+ if (HANDLE_EINTR(close(pipefds[0])) < 0)
+ PLOG(ERROR) << "close";
+ if (HANDLE_EINTR(close(pipefds[1])) < 0)
+ PLOG(ERROR) << "close";
}
} // namespace
diff --git a/base/message_pump_libevent.cc b/base/message_pump_libevent.cc
index c2390b4..ff4a04a 100644
--- a/base/message_pump_libevent.cc
+++ b/base/message_pump_libevent.cc
@@ -160,10 +160,14 @@ MessagePumpLibevent::~MessagePumpLibevent() {
DCHECK(event_base_);
event_del(wakeup_event_);
delete wakeup_event_;
- if (wakeup_pipe_in_ >= 0)
- HANDLE_EINTR(close(wakeup_pipe_in_));
- if (wakeup_pipe_out_ >= 0)
- HANDLE_EINTR(close(wakeup_pipe_out_));
+ if (wakeup_pipe_in_ >= 0) {
+ if (HANDLE_EINTR(close(wakeup_pipe_in_)) < 0)
+ PLOG(ERROR) << "close";
+ }
+ if (wakeup_pipe_out_ >= 0) {
+ if (HANDLE_EINTR(close(wakeup_pipe_out_)) < 0)
+ PLOG(ERROR) << "close";
+ }
event_base_free(event_base_);
}
diff --git a/chrome/browser/renderer_host/render_widget_helper.cc b/chrome/browser/renderer_host/render_widget_helper.cc
index baa8045..e2cd531 100644
--- a/chrome/browser/renderer_host/render_widget_helper.cc
+++ b/chrome/browser/renderer_host/render_widget_helper.cc
@@ -296,7 +296,8 @@ void RenderWidgetHelper::FreeTransportDIB(TransportDIB::Id dib_id) {
i = allocated_dibs_.find(dib_id);
if (i != allocated_dibs_.end()) {
- HANDLE_EINTR(close(i->second));
+ if (HANDLE_EINTR(close(i->second)) < 0)
+ PLOG(ERROR) << "close";
allocated_dibs_.erase(i);
} else {
DLOG(WARNING) << "Renderer asked us to free unknown transport DIB";
@@ -306,7 +307,8 @@ void RenderWidgetHelper::FreeTransportDIB(TransportDIB::Id dib_id) {
void RenderWidgetHelper::ClearAllocatedDIBs() {
for (std::map<TransportDIB::Id, int>::iterator
i = allocated_dibs_.begin(); i != allocated_dibs_.end(); ++i) {
- HANDLE_EINTR(close(i->second));
+ if (HANDLE_EINTR(close(i->second)) < 0)
+ PLOG(ERROR) << "close: " << i->first;
}
allocated_dibs_.clear();
diff --git a/ipc/file_descriptor_set_posix.cc b/ipc/file_descriptor_set_posix.cc
index 3796fae..7f17322 100644
--- a/ipc/file_descriptor_set_posix.cc
+++ b/ipc/file_descriptor_set_posix.cc
@@ -30,7 +30,8 @@ FileDescriptorSet::~FileDescriptorSet() {
for (unsigned i = consumed_descriptor_highwater_;
i < descriptors_.size(); ++i) {
if (descriptors_[i].auto_close)
- HANDLE_EINTR(close(descriptors_[i].fd));
+ if (HANDLE_EINTR(close(descriptors_[i].fd)) < 0)
+ PLOG(ERROR) << "close";
}
}
@@ -113,7 +114,8 @@ void FileDescriptorSet::CommitAll() {
for (std::vector<base::FileDescriptor>::iterator
i = descriptors_.begin(); i != descriptors_.end(); ++i) {
if (i->auto_close)
- HANDLE_EINTR(close(i->fd));
+ if (HANDLE_EINTR(close(i->fd)) < 0)
+ PLOG(ERROR) << "close";
}
descriptors_.clear();
consumed_descriptor_highwater_ = 0;
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();
}
diff --git a/net/socket/tcp_client_socket_libevent.cc b/net/socket/tcp_client_socket_libevent.cc
index 102a8fb..802dcc9 100644
--- a/net/socket/tcp_client_socket_libevent.cc
+++ b/net/socket/tcp_client_socket_libevent.cc
@@ -256,7 +256,8 @@ void TCPClientSocketLibevent::DoDisconnect() {
DCHECK(ok);
ok = write_socket_watcher_.StopWatchingFileDescriptor();
DCHECK(ok);
- HANDLE_EINTR(close(socket_));
+ if (HANDLE_EINTR(close(socket_)) < 0)
+ PLOG(ERROR) << "close";
socket_ = kInvalidSocket;
}