diff options
author | Mathias Preiner <mathias.preiner@gmail.com> | 2020-12-03 22:32:17 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-04 07:32:17 +0100 |
commit | 0b7ed19ab13a2bfa6278a0180768a9895aea9aff (patch) | |
tree | 26817bc9c50ed0f399224961f0a9f0efe7010293 /contrib | |
parent | 01d8991ad7059fff4807c2c597c04959d39ab176 (diff) |
update-copyright: Preserve file permissions. (#5597)
When updating the copyright headers file permissions were not preserved. In some cases this results in losing the permission to execute scripts. This commit makes sure to preserve the file permissions for updated files.
Diffstat (limited to 'contrib')
-rwxr-xr-x | contrib/update-copyright.pl | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/contrib/update-copyright.pl b/contrib/update-copyright.pl index 1f119d8e9..6a8482e76 100755 --- a/contrib/update-copyright.pl +++ b/contrib/update-copyright.pl @@ -257,6 +257,11 @@ sub handleFile { print $OUT $_; } close $OUT; + + # Preserve file permissions of $infile + my $perm = (stat($infile))[2] & 0777; + chmod $perm, $outfile; + rename($outfile, $infile) || die "can't rename working file \`$outfile' to \`$infile'"; } |