commit ed4f55c: [Fix] Add O_CREAT flag when creating a file

Vsevolod Stakhov vsevolod at rspamd.com
Wed Nov 16 21:14:03 UTC 2022


Author: Vsevolod Stakhov
Date: 2022-11-16 21:13:26 +0000
URL: https://github.com/rspamd/rspamd/commit/ed4f55c76d039bc728bb86128b817aeb5d8d3089 (HEAD -> master)

[Fix] Add O_CREAT flag when creating a file
Issue: #4337

---
 src/libutil/cxx/file_util.cxx | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/libutil/cxx/file_util.cxx b/src/libutil/cxx/file_util.cxx
index 4536fa97b..e5286a2cd 100644
--- a/src/libutil/cxx/file_util.cxx
+++ b/src/libutil/cxx/file_util.cxx
@@ -52,7 +52,7 @@ auto raii_file::open(const char *fname, int flags) -> tl::expected<raii_file, er
 
 auto raii_file::create(const char *fname, int flags, int perms) -> tl::expected<raii_file, error>
 {
-	int oflags = flags;
+	int oflags = flags|O_CREAT;
 #ifdef O_CLOEXEC
 	oflags |= O_CLOEXEC;
 #endif


More information about the Commits mailing list