TT#47373 Preserve config.yml attributes on copying for debug_mode

Otherwise kamailio-config-test reset file perms from 0600 to 0755.
From https://perldoc.perl.org/File/Copy.html :

> You may use the syntax use File::Copy "cp" to
> get at the cp alias for this function. The syntax is exactly the same.
> The behavior is nearly the same as well: as of version 2.15,
> cp will preserve the source file's permission bits like the
> shell utility cp(1) would do, while copy uses the default
> permissions for the target file
> (which may depend on the process' umask, file ownership, inherited ACLs, etc.).
> If an error occurs in setting permissions, cp will return 0,
> regardless of whether the file was successfully copied.

Change-Id: I7b227cb554699d68f809d38c82344d8f1afeed99
changes/64/24864/5
Alexander Lutay 8 years ago
parent 966ace9ff2
commit fb92f29cb0

@ -19,7 +19,7 @@
# Public License version 3 can be found in "/usr/share/common-licenses/GPL-3".
#
use English;
use File::Copy;
use File::Copy qw(cp move);
use File::Spec;
use Getopt::Long;
use strict;
@ -99,7 +99,7 @@ if (lc($action) eq "off")
}
else
{
copy($file, $file.".orig") or die "Copy failed: $ERRNO" unless(-e $file.".orig");
cp($file, $file.".orig") or die "Copy failed: $ERRNO" unless(-e $file.".orig");
$yaml = LoadFile($file);
$yaml->{kamailio}{lb}{cfgt} = 'yes';
$yaml->{kamailio}{lb}{dns}{use_dns_cache} = 'off';

Loading…
Cancel
Save