aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/tools
diff options
context:
space:
mode:
authorGravatar Eric Fellheimer <felly@google.com>2015-08-26 14:06:30 +0000
committerGravatar Philipp Wollermann <philwo@google.com>2015-08-27 14:44:18 +0000
commit48114109eb89bed684f2085a1ec2ddc3fa9ea902 (patch)
treed64e572716c081952de3f43af5957fad8d21c078 /src/main/tools
parentb5c3b3a1479f552c2ba2a844a84107efe16e8c50 (diff)
Make writes thread-safe during local tests by opening files with O_APPEND.
-- MOS_MIGRATED_REVID=101572272
Diffstat (limited to 'src/main/tools')
-rw-r--r--src/main/tools/process-tools.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/main/tools/process-tools.c b/src/main/tools/process-tools.c
index 48441e8485..e80131bbd6 100644
--- a/src/main/tools/process-tools.c
+++ b/src/main/tools/process-tools.c
@@ -50,7 +50,8 @@ int SwitchToEgid() {
void Redirect(const char *target_path, int fd, const char *name) {
if (target_path != NULL && strcmp(target_path, "-") != 0) {
int fd_out;
- CHECK_CALL(fd_out = open(target_path, O_WRONLY | O_CREAT | O_TRUNC, 0666),
+ const int flags = O_WRONLY | O_CREAT | O_TRUNC | O_APPEND;
+ CHECK_CALL(fd_out = open(target_path, flags, 0666),
"Could not open %s for redirection of %s", target_path, name);
CHECK_CALL(dup2(fd_out, fd));
CHECK_CALL(close(fd_out));