From d89eec809e2d25aee8d386186653699f5017b15b Mon Sep 17 00:00:00 2001 From: "mark@chromium.org" Date: Tue, 3 Dec 2013 14:10:59 +0000 Subject: 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 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 --- rlz/lib/recursive_cross_process_lock_posix.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'rlz/lib') diff --git a/rlz/lib/recursive_cross_process_lock_posix.cc b/rlz/lib/recursive_cross_process_lock_posix.cc index aa15897..c44cacf 100644 --- a/rlz/lib/recursive_cross_process_lock_posix.cc +++ b/rlz/lib/recursive_cross_process_lock_posix.cc @@ -59,7 +59,7 @@ bool RecursiveCrossProcessLock::TryGetCrossProcessLock( if (flock_result == -1) { perror("flock"); - ignore_result(HANDLE_EINTR(close(file_lock_))); + close(file_lock_); file_lock_ = -1; return false; } @@ -72,7 +72,7 @@ bool RecursiveCrossProcessLock::TryGetCrossProcessLock( void RecursiveCrossProcessLock::ReleaseLock() { if (file_lock_ != -1) { ignore_result(HANDLE_EINTR(flock(file_lock_, LOCK_UN))); - ignore_result(HANDLE_EINTR(close(file_lock_))); + close(file_lock_); file_lock_ = -1; } -- cgit v1.1