]> source.dussan.org Git - rspamd.git/commitdiff
[Fix] Add O_CREAT flag when creating a file
authorVsevolod Stakhov <vsevolod@rspamd.com>
Wed, 16 Nov 2022 21:13:26 +0000 (21:13 +0000)
committerVsevolod Stakhov <vsevolod@rspamd.com>
Wed, 16 Nov 2022 21:13:26 +0000 (21:13 +0000)
Issue: #4337

src/libutil/cxx/file_util.cxx

index 4536fa97bbd0e623e8f5aadce8a3fbe6937610ef..e5286a2cdee0cee7b714872aa26b8f86fdb3c58e 100644 (file)
@@ -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