summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--NEWS1
-rw-r--r--lib/MDK/Common/File.pm2
2 files changed, 3 insertions, 0 deletions
diff --git a/NEWS b/NEWS
index 9254060..1dc5b8d 100644
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,6 @@
- substInFile:
o ensure we keep old file as file.bak until we wrote new file
+ o call fsync() when editing a non empty file
Version 1.2.20 - 13 August 2009, by Aurelien Lefebvre
diff --git a/lib/MDK/Common/File.pm b/lib/MDK/Common/File.pm
index 71fe71c..cdcfcd9 100644
--- a/lib/MDK/Common/File.pm
+++ b/lib/MDK/Common/File.pm
@@ -289,6 +289,8 @@ sub substInFile(&@) {
&$f($_);
print;
}
+ open(my $F, $file);
+ fsync($F);
unlink "$file$^I"; # remove old backup now that we'have closed new file
} else {
local *F; my $old = select F; # that way eof return true