summaryrefslogtreecommitdiff
path: root/scripts
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 /scripts
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.
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/vyatta-save-config.pl6
1 files changed, 4 insertions, 2 deletions
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");