]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
dhcp: use conservative_rename() 18320/head
authorYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 20 Jan 2021 08:22:06 +0000 (17:22 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 22 Jan 2021 03:55:54 +0000 (12:55 +0900)
src/libsystemd-network/sd-dhcp-lease.c

index 8a138ff4b624fa69bcfd688f29f4d568d3209d5a..69ded6d1482a9d379e7f668affbb778ae8799603 100644 (file)
@@ -19,6 +19,7 @@
 #include "env-file.h"
 #include "fd-util.h"
 #include "fileio.h"
+#include "fs-util.h"
 #include "hexdecoct.h"
 #include "hostname-util.h"
 #include "in-addr-util.h"
@@ -1023,10 +1024,9 @@ int dhcp_lease_save(sd_dhcp_lease *lease, const char *lease_file) {
         if (r < 0)
                 goto fail;
 
-        if (rename(temp_path, lease_file) < 0) {
-                r = -errno;
+        r = conservative_rename(temp_path, lease_file);
+        if (r < 0)
                 goto fail;
-        }
 
         return 0;