diff options
author | mark@chromium.org <mark@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-12-03 14:10:59 +0000 |
---|---|---|
committer | mark@chromium.org <mark@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-12-03 14:10:59 +0000 |
commit | d89eec809e2d25aee8d386186653699f5017b15b (patch) | |
tree | b8b0433f5766958907ea4cebb7b954e82fc1148a /components/breakpad/browser/crash_handler_host_linux.cc | |
parent | 34b5946e889071a9c838a4b87d32437415148fed (diff) | |
download | chromium_src-d89eec809e2d25aee8d386186653699f5017b15b.zip chromium_src-d89eec809e2d25aee8d386186653699f5017b15b.tar.gz chromium_src-d89eec809e2d25aee8d386186653699f5017b15b.tar.bz2 |
Don't HANDLE_EINTR(close). Either IGNORE_EINTR(close) or just close.
It is incorrect to wrap close in HANDLE_EINTR on Linux. Correctness is
generally undefined on Mac, but as of r223369, it is incorrect in Chrome on
Mac.
To avoid new offenders, a PRESUBMIT check ensures that HANDLE_EINTR is not
used with close, and that IGNORE_EINTR is only used with close. Unnecessary
#includes of eintr_wrapper.h are also removed.
base/posix/einter_wrapper.h, PRESUBMIT.py, and ppapi/tests/test_broker.cc
contain non-mechanical changes. Variable naming within the latter is updated
per r178174. Missing #includes for <errno.h> in
content/zygote/zygote_main_linux.cc and tools/android/common/daemon.cc were
manually added. Mechanical changes were generated by running:
sed -E -i '' \
-e 's/((=|if|return|CHECK|EXPECT|ASSERT).*)HANDLE(_EINTR\(.*close)/\1IGNORE\3/' \
-e 's/(ignore_result|void ?)\(HANDLE_EINTR\((.*close\(.*)\)\)/\2/' \
-e 's/(\(void\) ?)?HANDLE_EINTR\((.*close\(.*)\)/\2/' \
$(git grep -El 'HANDLE_EINTR.*close')
sed -E -i '' -e '/#include.*eintr_wrapper\.h"/d' \
$(grep -EL '(HANDLE|IGNORE)_EINTR' \
$(git grep -El '#include.*eintr_wrapper\.h"'))
BUG=269623
R=agl@chromium.org, jln@chromium.org
TBR=OWNERS
Review URL: https://codereview.chromium.org/100253002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@238390 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'components/breakpad/browser/crash_handler_host_linux.cc')
-rw-r--r-- | components/breakpad/browser/crash_handler_host_linux.cc | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/components/breakpad/browser/crash_handler_host_linux.cc b/components/breakpad/browser/crash_handler_host_linux.cc index b8794d2..cefcd19 100644 --- a/components/breakpad/browser/crash_handler_host_linux.cc +++ b/components/breakpad/browser/crash_handler_host_linux.cc @@ -108,8 +108,8 @@ CrashHandlerHostLinux::CrashHandlerHostLinux(const std::string& process_type, } CrashHandlerHostLinux::~CrashHandlerHostLinux() { - (void) HANDLE_EINTR(close(process_socket_)); - (void) HANDLE_EINTR(close(browser_socket_)); + close(process_socket_); + close(browser_socket_); } void CrashHandlerHostLinux::StartUploaderThread() { @@ -236,7 +236,7 @@ void CrashHandlerHostLinux::OnFileCanReadWithoutBlocking(int fd) { LOG(ERROR) << "Death signal contained wrong number of descriptors;" << " num_fds:" << num_fds; for (unsigned i = 0; i < num_fds; ++i) - (void) HANDLE_EINTR(close(reinterpret_cast<int*>(CMSG_DATA(hdr))[i])); + close(reinterpret_cast<int*>(CMSG_DATA(hdr))[i]); return; } else { partner_fd = reinterpret_cast<int*>(CMSG_DATA(hdr))[0]; @@ -253,9 +253,9 @@ void CrashHandlerHostLinux::OnFileCanReadWithoutBlocking(int fd) { LOG(ERROR) << "Death signal message didn't contain all expected control" << " messages"; if (partner_fd >= 0) - (void) HANDLE_EINTR(close(partner_fd)); + close(partner_fd); if (signal_fd >= 0) - (void) HANDLE_EINTR(close(signal_fd)); + close(signal_fd); return; } @@ -273,17 +273,17 @@ void CrashHandlerHostLinux::OnFileCanReadWithoutBlocking(int fd) { ino_t inode_number; if (!base::FileDescriptorGetInode(&inode_number, partner_fd)) { LOG(WARNING) << "Failed to get inode number for passed socket"; - (void) HANDLE_EINTR(close(partner_fd)); - (void) HANDLE_EINTR(close(signal_fd)); + close(partner_fd); + close(signal_fd); return; } - (void) HANDLE_EINTR(close(partner_fd)); + close(partner_fd); pid_t actual_crashing_pid = -1; if (!base::FindProcessHoldingSocket(&actual_crashing_pid, inode_number)) { LOG(WARNING) << "Failed to find process holding other end of crash reply " "socket"; - (void) HANDLE_EINTR(close(signal_fd)); + close(signal_fd); return; } @@ -442,7 +442,7 @@ void CrashHandlerHostLinux::QueueCrashDumpTask(BreakpadInfo* info, msg.msg_iovlen = 1; (void) HANDLE_EINTR(sendmsg(signal_fd, &msg, MSG_DONTWAIT | MSG_NOSIGNAL)); - (void) HANDLE_EINTR(close(signal_fd)); + close(signal_fd); uploader_thread_->message_loop()->PostTask( FROM_HERE, |