Ticket #5960: 9000-xar-quagga_save_config.patch

File 9000-xar-quagga_save_config.patch, 1.2 KB (added by tries@…, 8 years ago)

patch to quagga-unstable: fix failure of write config to disk

  • quagga-0.99.15/lib/command.c

    old new  
    26012601                 VTY_NEWLINE); 
    26022602        goto finished; 
    26032603      } 
     2604 
     2605#if 0 
     2606  /* This code fails on UNION MOUNTs and similar filesystems if the 
     2607   * config file is still on the RO layer. Hardlinks across layers 
     2608   * will not work and cause quagga to fail saving the configuration... 
     2609   * should use rename() to move files around... 
     2610   */ 
    26042611  if (link (config_file, config_file_sav) != 0) 
    26052612    { 
    26062613      vty_out (vty, "Can't backup old configuration file %s.%s", config_file_sav, 
     
    26142621                VTY_NEWLINE); 
    26152622      goto finished; 
    26162623    } 
     2624#else 
     2625  /* And this is the code that hopefully does work */ 
     2626  if (rename (config_file, config_file_sav) != 0) 
     2627    { 
     2628      vty_out (vty, "Can't backup old configuration file %s.%s", config_file_sav, 
     2629                VTY_NEWLINE); 
     2630      goto finished; 
     2631    } 
     2632  sync (); 
     2633#endif 
     2634 
     2635#if 0 
     2636  /* same here. Please no cross-filesystem hardlinks... */ 
    26172637  if (link (config_file_tmp, config_file) != 0) 
     2638#else 
     2639  if (rename (config_file_tmp, config_file) != 0) 
     2640#endif 
    26182641    { 
    26192642      vty_out (vty, "Can't save configuration file %s.%s", config_file, 
    26202643               VTY_NEWLINE);