commit 3d80e66: [Minor] Use `mkstemp` in one more place

Vsevolod Stakhov vsevolod at rspamd.com
Sat Mar 4 13:49:03 UTC 2023


Author: Vsevolod Stakhov
Date: 2023-03-04 12:41:56 +0000
URL: https://github.com/rspamd/rspamd/commit/3d80e66c8f8b734208d0eed314b406f309173286

[Minor] Use `mkstemp` in one more place

---
 src/libserver/re_cache.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/libserver/re_cache.c b/src/libserver/re_cache.c
index f4d2496b1..c89536206 100644
--- a/src/libserver/re_cache.c
+++ b/src/libserver/re_cache.c
@@ -1941,9 +1941,9 @@ rspamd_re_cache_compile_timer_cb (EV_P_ ev_timer *w, int revents )
 		return;
 	}
 
-	rspamd_snprintf (path, sizeof (path), "%s%c%s.%P.hs.new", cbdata->cache_dir,
+	rspamd_snprintf (path, sizeof (path), "%s%c%P-XXXXXXXXXX", cbdata->cache_dir,
 			G_DIR_SEPARATOR, re_class->hash, our_pid);
-	fd = open (path, O_CREAT|O_TRUNC|O_EXCL|O_WRONLY, 00600);
+	fd = g_mkstemp_full(path, O_CREAT|O_TRUNC|O_EXCL|O_WRONLY, 00600);
 
 	if (fd == -1) {
 		err = g_error_new (rspamd_re_cache_quark (), errno,


More information about the Commits mailing list