Add O_APPEND flag for __libc_write_stderr.
For DeathTests, we are testing the output of stderr to check if it is the death we are expecting. To collect the output, Gtest redirects stderr to a temporary file. But in __libc_write_stderr in libc_logging.cpp, we are writing to stderr without a O_APPEND flag, so a new message will overwrite a previous message. The above situation makes almost all the DeathTests fail on host. Because the expected message are always overwritten in host DeathTests. So I add O_APPEND flag in __libc_write_stderr, which makes all host DeathTests pass. Change-Id: Ic2f6044fdb181eebe132a6f170b57db43c5c3289
This commit is contained in:
parent
93d44ff2a6
commit
28e69f7508
1 changed files with 1 additions and 1 deletions
|
@ -427,7 +427,7 @@ int __libc_format_fd(int fd, const char* format, ...) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static int __libc_write_stderr(const char* tag, const char* msg) {
|
static int __libc_write_stderr(const char* tag, const char* msg) {
|
||||||
int fd = TEMP_FAILURE_RETRY(open("/dev/stderr", O_CLOEXEC | O_WRONLY));
|
int fd = TEMP_FAILURE_RETRY(open("/dev/stderr", O_CLOEXEC | O_WRONLY | O_APPEND));
|
||||||
if (fd == -1) {
|
if (fd == -1) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue