mirror of
https://git.suyu.dev/suyu/breakpad.git
synced 2025-12-31 11:44:48 +01:00
Don't HANDLE_EINTR(close). Either IGNORE_EINTR(close) or just close.
It is incorrect to wrap close in HANDLE_EINTR on Linux.
Unnecessary #includes of eintr_wrapper.h are also removed. The variable naming
within the macro is also updated per Chromium r178174.
einter_wrapper.h contains a non-mechanical change. 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/' \
$(grep -rl HANDLE_EINTR.*close . --exclude-dir=.svn)
sed -E -i '' -e '/#include.*eintr_wrapper\.h"/d' \
$(grep -EL '(HANDLE|IGNORE)_EINTR' \
$(grep -Elr '#include.*eintr_wrapper\.h"' . --exclude-dir=.svn))
BUG=chromium:269623
R=ted.mielczarek@gmail.com
Review URL: https://breakpad.appspot.com/784002
git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1239 4c0a9323-5329-0410-9bdc-e9ce6186880e
This commit is contained in:
parent
b303174e32
commit
036dec3ecc
7 changed files with 26 additions and 19 deletions
|
|
@ -37,11 +37,22 @@
|
|||
//
|
||||
|
||||
#define HANDLE_EINTR(x) ({ \
|
||||
typeof(x) __eintr_result__; \
|
||||
typeof(x) eintr_wrapper_result; \
|
||||
do { \
|
||||
__eintr_result__ = x; \
|
||||
} while (__eintr_result__ == -1 && errno == EINTR); \
|
||||
__eintr_result__;\
|
||||
eintr_wrapper_result = (x); \
|
||||
} while (eintr_wrapper_result == -1 && errno == EINTR); \
|
||||
eintr_wrapper_result; \
|
||||
})
|
||||
|
||||
#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; \
|
||||
})
|
||||
|
||||
#endif // COMMON_LINUX_EINTR_WRAPPER_H_
|
||||
|
|
|
|||
|
|
@ -37,7 +37,6 @@
|
|||
#include <string>
|
||||
|
||||
#include "breakpad_googletest_includes.h"
|
||||
#include "common/linux/eintr_wrapper.h"
|
||||
#include "common/linux/memory_mapped_file.h"
|
||||
#include "common/tests/auto_tempdir.h"
|
||||
#include "common/tests/file_utils.h"
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ bool CopyFile(const char* from_path, const char* to_path) {
|
|||
int outfile = HANDLE_EINTR(creat(to_path, 0666));
|
||||
if (outfile < 0) {
|
||||
perror("creat");
|
||||
if (HANDLE_EINTR(close(infile)) < 0) {
|
||||
if (IGNORE_EINTR(close(infile)) < 0) {
|
||||
perror("close");
|
||||
}
|
||||
return false;
|
||||
|
|
@ -84,11 +84,11 @@ bool CopyFile(const char* from_path, const char* to_path) {
|
|||
} while (bytes_written_per_read < bytes_read);
|
||||
}
|
||||
|
||||
if (HANDLE_EINTR(close(infile)) == -1) {
|
||||
if (IGNORE_EINTR(close(infile)) == -1) {
|
||||
perror("close");
|
||||
result = false;
|
||||
}
|
||||
if (HANDLE_EINTR(close(outfile)) == -1) {
|
||||
if (IGNORE_EINTR(close(outfile)) == -1) {
|
||||
perror("close");
|
||||
result = false;
|
||||
}
|
||||
|
|
@ -112,7 +112,7 @@ bool ReadFile(const char* path, void* buffer, ssize_t* buffer_size) {
|
|||
ok = false;
|
||||
}
|
||||
}
|
||||
if (HANDLE_EINTR(close(fd)) == -1) {
|
||||
if (IGNORE_EINTR(close(fd)) == -1) {
|
||||
perror("close");
|
||||
ok = false;
|
||||
}
|
||||
|
|
@ -143,7 +143,7 @@ bool WriteFile(const char* path, const void* buffer, size_t buffer_size) {
|
|||
bytes_written_total += bytes_written_partial;
|
||||
}
|
||||
}
|
||||
if (HANDLE_EINTR(close(fd)) == -1) {
|
||||
if (IGNORE_EINTR(close(fd)) == -1) {
|
||||
perror("close");
|
||||
ok = false;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue