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

Unified Diff: base/file_descriptor_shuffle.cc

Issue 100225: POSIX: Add a macro for handling EINTR. (Closed)
Patch Set: ... Created 11 years, 8 months 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/eintr_wrappers.h ('k') | base/file_util_linux.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/file_descriptor_shuffle.cc
diff --git a/base/file_descriptor_shuffle.cc b/base/file_descriptor_shuffle.cc
index 1426155a271fce41418299deaca95fcc1788df0e..2b6afd196db0f159d7f5422865acc7f43b3a6a69 100644
--- a/base/file_descriptor_shuffle.cc
+++ b/base/file_descriptor_shuffle.cc
@@ -7,6 +7,7 @@
#include <errno.h>
#include <unistd.h>
+#include "base/eintr_wrappers.h"
#include "base/logging.h"
namespace base {
@@ -64,29 +65,16 @@ bool PerformInjectiveMultimap(const InjectiveMultimap& m_in,
}
bool FileDescriptorTableInjection::Duplicate(int* result, int fd) {
- do {
- *result = dup(fd);
- } while(*result == -1 && errno == EINTR);
-
+ *result = HANDLE_EINTR(dup(fd));
return *result >= 0;
}
bool FileDescriptorTableInjection::Move(int src, int dest) {
- int result;
-
- do {
- result = dup2(src, dest);
- } while (result == -1 && errno == EINTR);
-
- return result != -1;
+ return HANDLE_EINTR(dup2(src, dest)) != -1;
}
void FileDescriptorTableInjection::Close(int fd) {
- int result;
-
- do {
- result = close(fd);
- } while (result == -1 && errno == EINTR);
+ HANDLE_EINTR(close(fd));
}
} // namespace base
« no previous file with comments | « base/eintr_wrappers.h ('k') | base/file_util_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698