summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Hemminger <stephen.hemminger@vyatta.com>2009-10-30 10:58:53 -0700
committerStephen Hemminger <stephen.hemminger@vyatta.com>2009-10-30 10:58:53 -0700
commitdd187d067a88fcf2bc8a3de955ea87de406c6d30 (patch)
treedec7c361dae9e776ae91f186beb709686d603eb5
parentd6a2a698c256ec913321c859f3d1e85f1775a09d (diff)
downloadvyatta-cfg-dd187d067a88fcf2bc8a3de955ea87de406c6d30.tar.gz
vyatta-cfg-dd187d067a88fcf2bc8a3de955ea87de406c6d30.zip
Sync config file after saving
By calling fsync, we can be more assured that file actually makes it to disk.
-rw-r--r--debian/control4
-rwxr-xr-xscripts/vyatta-save-config.pl6
2 files changed, 7 insertions, 3 deletions
diff --git a/debian/control b/debian/control
index bd43446..28171cc 100644
--- a/debian/control
+++ b/debian/control
@@ -21,14 +21,16 @@ Depends: sed (>= 4.1.5),
bsdutils (>=1:2.13),
libc6 (>= 2.7-6),
libsort-versions-perl,
+ libfile-sync-perl,
vlan,
+ ethtool,
+ iproute,
libglib2.0-0,
curl
Replaces: vyatta-cfg-firewall,
vyatta-cfg-quagga
Suggests: util-linux (>= 2.13-5),
net-tools,
- ethtool,
ncurses-bin (>= 5.5-5),
ntpdate
Description: Vyatta configuration system
diff --git a/scripts/vyatta-save-config.pl b/scripts/vyatta-save-config.pl
index e8220c0..9a95906 100755
--- a/scripts/vyatta-save-config.pl
+++ b/scripts/vyatta-save-config.pl
@@ -22,6 +22,7 @@
use strict;
use lib "/opt/vyatta/share/perl5";
use Vyatta::ConfigOutput;
+use File::Sync qw(fsync);
my $etcdir = "/opt/vyatta/etc";
my $bootpath = $etcdir . "/config";
@@ -91,10 +92,11 @@ select $save;
set_show_all(1);
outputActiveConfig();
print $version_str;
-close $save;
-
select STDOUT;
+fsync $save;
+close $save;
+
if ($mode eq 'url') {
my $rc = system("curl -# -T $url_tmp_file $save_file");
system("rm -f $url_tmp_file");