2010-01-14 19:19:22 +00:00
|
|
|
--- a/lib/command.c
|
|
|
|
+++ b/lib/command.c
|
2010-10-15 21:43:27 +00:00
|
|
|
@@ -2567,6 +2567,13 @@
|
|
|
|
unlink (config_file_tmp);
|
|
|
|
return CMD_WARNING;
|
2010-01-14 19:19:22 +00:00
|
|
|
}
|
|
|
|
+
|
|
|
|
+#if 0
|
|
|
|
+ /* This code fails on UNION MOUNTs and similar filesystems if the
|
|
|
|
+ * config file is still on the RO layer. Hardlinks across layers
|
|
|
|
+ * will not work and cause quagga to fail saving the configuration...
|
|
|
|
+ * should use rename() to move files around...
|
|
|
|
+ */
|
|
|
|
if (link (config_file, config_file_sav) != 0)
|
|
|
|
{
|
|
|
|
vty_out (vty, "Can't backup old configuration file %s.%s", config_file_sav,
|
2010-10-15 21:43:27 +00:00
|
|
|
@@ -2586,7 +2593,23 @@
|
|
|
|
unlink (config_file_tmp);
|
|
|
|
return CMD_WARNING;
|
2010-01-14 19:19:22 +00:00
|
|
|
}
|
|
|
|
+#else
|
|
|
|
+ /* And this is the code that hopefully does work */
|
|
|
|
+ if (rename (config_file, config_file_sav) != 0)
|
|
|
|
+ {
|
|
|
|
+ vty_out (vty, "Can't backup old configuration file %s.%s", config_file_sav,
|
|
|
|
+ VTY_NEWLINE);
|
2010-10-15 21:43:27 +00:00
|
|
|
+ return CMD_WARNING;
|
2010-01-14 19:19:22 +00:00
|
|
|
+ }
|
|
|
|
+ sync ();
|
|
|
|
+#endif
|
|
|
|
+
|
|
|
|
+#if 0
|
|
|
|
+ /* same here. Please no cross-filesystem hardlinks... */
|
|
|
|
if (link (config_file_tmp, config_file) != 0)
|
|
|
|
+#else
|
|
|
|
+ if (rename (config_file_tmp, config_file) != 0)
|
|
|
|
+#endif
|
|
|
|
{
|
|
|
|
vty_out (vty, "Can't save configuration file %s.%s", config_file,
|
|
|
|
VTY_NEWLINE);
|