X-Git-Url: http://ftp.carnet.hr/carnet-debian/scm?p=carnet-tools-cn.git;a=blobdiff_plain;f=cp-update;h=5514ee650c07b37d685e878133999c6c0b30726a;hp=00ad0d942d9baf32e760084fefdefa93eef85e62;hb=refs%2Fheads%2Flenny;hpb=794b05eb76c5fa0ae149bf69a35b8ead99b8fd30 diff --git a/cp-update b/cp-update index 00ad0d9..5514ee6 100755 --- a/cp-update +++ b/cp-update @@ -35,7 +35,7 @@ sub DEBUG () { 0 }; # my ($ProgramName, $UsageLong, $UsageShort, $VERSION); -$VERSION = '2.0'; +$VERSION = '2.1'; # Looks nicer without the slashes and dots ($ProgramName = $0) =~ s!.*/!!; # strip dir @@ -459,7 +459,7 @@ sub actualize() { $file_new .= '.cp-update.new'; # our .new file $file_old .= '.cp-update.old'; # our .old file # write content in new file in single write op - sysopen ($FileHandle, $file_new, O_CREAT|O_TRUNC|O_WRONLY) + sysopen ($FileHandle, $file_new, O_CREAT|O_TRUNC|O_WRONLY, (stat($File))[2]) or die "$ProgramName: Failed to open file '$File' for writing ($!)\n"; if (length($newContent)) { my $wb = syswrite($FileHandle, $newContent); @@ -492,6 +492,7 @@ sub actualize() { unlink($file_old) or warn "$ProgramName: Failed to remove file '$file_old' ($!)\n"; } + DEBUG and print STDERR "actualize: LinesCount=$LinesCount\n"; } # return content from standard input