From ec93242897ef7636704f45f0c0404529e840ee45 Mon Sep 17 00:00:00 2001
From: Stephan Bosch <stephan@rename-it.nl>
Date: Wed, 29 Oct 2008 01:12:44 +0100
Subject: [PATCH] Fixed missing mask argument in two open calls (bug found by
 Sergey Ivanov).

---
 src/sieve-bin/bin-common.c | 2 +-
 src/testsuite/testsuite.c  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/sieve-bin/bin-common.c b/src/sieve-bin/bin-common.c
index 7deb5dd6a..98e3b3639 100644
--- a/src/sieve-bin/bin-common.c
+++ b/src/sieve-bin/bin-common.c
@@ -116,7 +116,7 @@ void bin_dump_sieve_binary_to(struct sieve_binary *sbin, const char *filename)
 	if ( strcmp(filename, "-") == 0 ) 
 		dumpstream = o_stream_create_fd(1, 0, FALSE);
 	else {
-		if ( (dfd = open(filename, O_WRONLY | O_CREAT)) < 0 ) {
+		if ( (dfd = open(filename, O_WRONLY | O_TRUNC | O_CREAT, 0600)) < 0 ) {
 			i_fatal("Failed to open dump-file for writing: %m");
 			exit(1);
 		}
diff --git a/src/testsuite/testsuite.c b/src/testsuite/testsuite.c
index 986de73a1..f31d2de07 100644
--- a/src/testsuite/testsuite.c
+++ b/src/testsuite/testsuite.c
@@ -119,7 +119,7 @@ static void _dump_sieve_binary_to(struct sieve_binary *sbin, const char *filenam
 	if ( strcmp(filename, "-") == 0 ) 
 		dumpstream = o_stream_create_fd(1, 0, FALSE);
 	else {
-		if ( (dfd = open(filename, O_WRONLY | O_CREAT)) < 0 ) {
+		if ( (dfd = open(filename, O_WRONLY | O_TRUNC | O_CREAT, 0600)) < 0 ) {
 			i_fatal("Failed to open dump-file for writing: %m");
 			exit(1);
 		}
-- 
GitLab