Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(99)

Unified Diff: PRESUBMIT.py

Issue 100253002: Don't HANDLE_EINTR(close). Either IGNORE_EINTR(close) or just close. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | base/debug/debugger_posix.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: PRESUBMIT.py
diff --git a/PRESUBMIT.py b/PRESUBMIT.py
index 414cee8fe49ff67b01316bfd258887364262617b..f0e77e908ccb6cd40769f03dc53e9575d434bdcc 100644
--- a/PRESUBMIT.py
+++ b/PRESUBMIT.py
@@ -202,6 +202,30 @@ _BANNED_CPP_FUNCTIONS = (
True,
(),
),
+ (
+ r'/HANDLE_EINTR\(.*close',
+ (
+ 'HANDLE_EINTR(close) is invalid. If close fails with EINTR, the file',
+ 'descriptor will be closed, and it is incorrect to retry the close.',
+ 'Either call close directly and ignore its return value, or wrap close',
+ 'in IGNORE_EINTR to use its return value. See http://crbug.com/269623'
+ ),
+ True,
+ (),
+ ),
+ (
+ r'/IGNORE_EINTR\((?!.*close)',
+ (
+ 'IGNORE_EINTR is only valid when wrapping close. To wrap other system',
+ 'calls, use HANDLE_EINTR. See http://crbug.com/269623',
+ ),
+ True,
+ (
+ # Files that #define IGNORE_EINTR.
+ r'^base[\\\/]posix[\\\/]eintr_wrapper\.h$',
+ r'^ppapi[\\\/]tests[\\\/]test_broker\.cc$',
+ ),
+ ),
)
@@ -375,7 +399,14 @@ def _CheckNoBannedFunctions(input_api, output_api):
return False
if IsBlacklisted(f, excluded_paths):
continue
- if func_name in line:
+ matched = False
+ if func_name[0:1] == '/':
+ regex = func_name[1:]
+ if input_api.re.search(regex, line):
+ matched = True
+ elif func_name in line:
+ matched = True
+ if matched:
problems = warnings;
if error:
problems = errors;
« no previous file with comments | « no previous file | base/debug/debugger_posix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698