[PATCH rhel6-branch] Write directly to /etc/sysconfig/network so that inotify works (#845572)
Radek Vykydal
rvykydal at redhat.com
Thu Jun 27 15:07:22 UTC 2013
Resolves: rhbz#845572
Calling rename() on new temporary /etc/sysconfig/.network file used to break
inotify (IN_CLOSE_WRITE) mechanism on /etc/sysconfig/network file and therefore
update of system hostname by NM didn't work.
---
loader/net.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/loader/net.c b/loader/net.c
index 93a9c6f..ee83860 100644
--- a/loader/net.c
+++ b/loader/net.c
@@ -1579,7 +1579,7 @@ int writeEnabledNetInfo(iface_t *iface) {
}
/* Global settings */
- if ((fp = fopen(SYSCONFIG_PATH"/.network", "w")) == NULL) {
+ if ((fp = fopen(SYSCONFIG_PATH"/network", "w")) == NULL) {
return 9;
}
@@ -1619,15 +1619,11 @@ int writeEnabledNetInfo(iface_t *iface) {
}
#endif
+ /* This triggers NM's inotify mechanism for updating system hostname */
if (fclose(fp) == EOF) {
return 12;
}
- if (rename(SYSCONFIG_PATH"/.network",
- SYSCONFIG_PATH"/network") == -1) {
- return 15;
- }
-
return 0;
}
--
1.7.11.7
More information about the anaconda-patches
mailing list