From c5424e6992a045c568931605cbb466e32deb0cb7 Mon Sep 17 00:00:00 2001 From: Přemysl Eric Janouch
Date: Sat, 10 Feb 2024 06:16:27 +0100 Subject: Comment on write_file_safe()'s actual safety --- liberty.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/liberty.c b/liberty.c index 4d27127..e438c34 100644 --- a/liberty.c +++ b/liberty.c @@ -3552,6 +3552,8 @@ write_file_safe (const char *filename, const void *data, size_t data_len, { // XXX: ideally we would also open the directory, use *at() versions // of functions and call fsync() on the directory as appropriate + // FIXME: this should behave similarly to mkstemp(), just with 0666; + // as it is, this function is not particularly safe char *temp = xstrdup_printf ("%s.new", filename); bool success = write_file (temp, data, data_len, e); if (success && !(success = !rename (temp, filename))) -- cgit v1.2.3-70-g09d2