modernize backfire 10.03 so it can be operational again
[openwrt-10.03/.git] / package / quagga / not-patches / patches-pgbgp / 150-no-cross-fs-link.patch
1 --- a/lib/command.c
2 +++ b/lib/command.c
3 @@ -3064,6 +3064,13 @@ DEFUN (config_write_file,
4                  VTY_NEWLINE);
5          goto finished;
6        }
7 +
8 +#if 0
9 +  /* This code fails on UNION MOUNTs and similar filesystems if the
10 +   * config file is still on the RO layer. Hardlinks across layers
11 +   * will not work and cause quagga to fail saving the configuration...
12 +   * should use rename() to move files around...
13 +   */
14    if (link (config_file, config_file_sav) != 0)
15      {
16        vty_out (vty, "Can't backup old configuration file %s.%s", config_file_sav,
17 @@ -3077,7 +3084,23 @@ DEFUN (config_write_file,
18                 VTY_NEWLINE);
19        goto finished;
20      }
21 +#else
22 +  /* And this is the code that hopefully does work */
23 +  if (rename (config_file, config_file_sav) != 0)
24 +    {
25 +      vty_out (vty, "Can't backup old configuration file %s.%s", config_file_sav,
26 +               VTY_NEWLINE);
27 +      goto finished;
28 +    }
29 +  sync ();
30 +#endif
31 +
32 +#if 0
33 +  /* same here. Please no cross-filesystem hardlinks... */
34    if (link (config_file_tmp, config_file) != 0)
35 +#else
36 +  if (rename (config_file_tmp, config_file) != 0)
37 +#endif
38      {
39        vty_out (vty, "Can't save configuration file %s.%s", config_file,
40                VTY_NEWLINE);