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

Unified Diff: base/posix/eintr_wrapper.h

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 | « base/platform_file_posix.cc ('k') | base/posix/file_descriptor_shuffle.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/posix/eintr_wrapper.h
diff --git a/base/posix/eintr_wrapper.h b/base/posix/eintr_wrapper.h
index 8e26752337066162e14f0c65a1a06f41985d619f..854c43a67cba848f418cb4a3ad901393590b1d7b 100644
--- a/base/posix/eintr_wrapper.h
+++ b/base/posix/eintr_wrapper.h
@@ -9,6 +9,9 @@
// caller will nonetheless see an EINTR in Debug builds.
//
// On Windows, this wrapper macro does nothing.
+//
+// Don't wrap close calls in HANDLE_EINTR. Use IGNORE_EINTR if the return
+// value of close is significant. See http://crbug.com/269623.
#ifndef BASE_POSIX_EINTR_WRAPPER_H_
#define BASE_POSIX_EINTR_WRAPPER_H_
@@ -20,6 +23,7 @@
#include <errno.h>
#if defined(NDEBUG)
+
#define HANDLE_EINTR(x) ({ \
typeof(x) eintr_wrapper_result; \
do { \
@@ -42,9 +46,21 @@
#endif // NDEBUG
+#define IGNORE_EINTR(x) ({ \
+ typeof(x) eintr_wrapper_result; \
+ do { \
+ eintr_wrapper_result = (x); \
+ if (eintr_wrapper_result == -1 && errno == EINTR) { \
+ eintr_wrapper_result = 0; \
+ } \
+ } while (0); \
+ eintr_wrapper_result; \
+})
+
#else
#define HANDLE_EINTR(x) (x)
+#define IGNORE_EINTR(x) (x)
#endif // OS_POSIX
« no previous file with comments | « base/platform_file_posix.cc ('k') | base/posix/file_descriptor_shuffle.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698