]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
network: use conservative_rename() to reduce to trigger network events
authorYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 20 Jan 2021 08:18:10 +0000 (17:18 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 22 Jan 2021 03:55:54 +0000 (12:55 +0900)
networkd part to fix #17577.

Note resolved part is f3e1f00d03445911ee73729219cea88c8a70c612.

src/network/networkd-link.c
src/network/networkd-manager.c

index 5fbf88c332857aef7f6878572ddd0b267558e2fc..fe6d3bd927c87832f3ab27b50a97e05b4956669d 100644 (file)
@@ -16,6 +16,7 @@
 #include "ethtool-util.h"
 #include "fd-util.h"
 #include "fileio.h"
+#include "fs-util.h"
 #include "ipvlan.h"
 #include "missing_network.h"
 #include "netlink-util.h"
@@ -3175,10 +3176,9 @@ int link_save(Link *link) {
         if (r < 0)
                 goto fail;
 
-        if (rename(temp_path, link->state_file) < 0) {
-                r = -errno;
+        r = conservative_rename(temp_path, link->state_file);
+        if (r < 0)
                 goto fail;
-        }
 
         return 0;
 
index bf15ba653524bde8eb684805813dd5055e01ece8..befecdc323bbeeabde8534141b58c16abc7d7d8e 100644 (file)
@@ -23,6 +23,7 @@
 #include "fd-util.h"
 #include "fileio.h"
 #include "firewall-util.h"
+#include "fs-util.h"
 #include "local-addresses.h"
 #include "netlink-util.h"
 #include "network-internal.h"
@@ -709,10 +710,9 @@ static int manager_save(Manager *m) {
         if (r < 0)
                 goto fail;
 
-        if (rename(temp_path, m->state_file) < 0) {
-                r = -errno;
+        r = conservative_rename(temp_path, m->state_file);
+        if (r < 0)
                 goto fail;
-        }
 
         if (m->operational_state != operstate) {
                 m->operational_state = operstate;