summaryrefslogtreecommitdiffstats
path: root/lib/MDK/Common/File.pm
diff options
context:
space:
mode:
authorThierry Vignaud <tv@mandriva.org>2009-10-07 16:31:47 +0000
committerThierry Vignaud <tv@mandriva.org>2009-10-07 16:31:47 +0000
commit13f00299526653d35c7787bb46aaf11e8eae3b73 (patch)
tree0b88034d9a15fe01ebcf71da22425ae5e1a04f74 /lib/MDK/Common/File.pm
parent6d0c7a137813b33cb4e658502153f7c31f8f80e7 (diff)
downloadperl-MDK-Common-13f00299526653d35c7787bb46aaf11e8eae3b73.tar
perl-MDK-Common-13f00299526653d35c7787bb46aaf11e8eae3b73.tar.gz
perl-MDK-Common-13f00299526653d35c7787bb46aaf11e8eae3b73.tar.bz2
perl-MDK-Common-13f00299526653d35c7787bb46aaf11e8eae3b73.tar.xz
perl-MDK-Common-13f00299526653d35c7787bb46aaf11e8eae3b73.zip
(substInFile) call fsync() when editing a non empty file
Diffstat (limited to 'lib/MDK/Common/File.pm')
-rw-r--r--lib/MDK/Common/File.pm2
1 files changed, 2 insertions, 0 deletions
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