From: Sangeetha Elumalai <sangeetha.elumalai@timesys.com>
Date: Wed, 25 Nov 2026 10:01:03 +0530

diff --git a/src/storage.c b/src/storage.c
index 2115a87..50457d4 100644
--- a/src/storage.c
+++ b/src/storage.c
@@ -142,16 +142,23 @@ ssize_t write_file(const void *buffer, size_t len, bool preserve_times,
 	path = l_strdup_vprintf(path_fmt, ap);
 	va_end(ap);
 
-	tmp_path = l_strdup_printf("%s.XXXXXX.tmp", path);
 
 	r = -1;
 	if (create_dirs(path) != 0)
 		goto error_create_dirs;
 
+#if defined(__GLIBC__) && !defined(__UCLIBC__)
+	tmp_path = l_strdup_printf("%s.XXXXXX.tmp", path);
 	fd = L_TFR(mkostemps(tmp_path, 4, O_CLOEXEC));
 	if (fd == -1)
 		goto error_mkostemps;
 
+#else
+	tmp_path = l_strdup_printf("%s.XXXXXX", path);
+	fd = L_TFR(mkstemp(tmp_path));
+	if (fd == -1)
+		goto error_mkostemps;
+#endif
 	r = L_TFR(write(fd, buffer, len));
 	L_TFR(close(fd));
 
-- 
2.25.1

