diff options
author | Eric Wong <e@80x24.org> | 2016-12-12 12:02:45 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2016-12-12 12:04:23 +0000 |
commit | 3043725a10eae59a71c25ba5e4d424a49326afd7 (patch) | |
tree | 6d18b1c384c087ed29a6f74a57a8aa5611889c4b /script | |
parent | 53e8cfbe4e06e5ae6ad61fb7e9bd45804c253a72 (diff) | |
download | public-inbox-3043725a10eae59a71c25ba5e4d424a49326afd7.tar.gz |
This matches git-config(1) behavior, and implied user intent when it comes to programatically editing files.
Diffstat (limited to 'script')
-rwxr-xr-x | script/public-inbox-init | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/script/public-inbox-init b/script/public-inbox-init index 739ec9e5..e23d1419 100755 --- a/script/public-inbox-init +++ b/script/public-inbox-init @@ -28,6 +28,11 @@ mkpath($dir); # will croak on fatal errors my ($fh, $filename) = tempfile('pi-init-XXXXXXXX', DIR => $dir); if (-e $pi_config) { open(my $oh, '<', $pi_config) or die "unable to read $pi_config: $!\n"; + my @st = stat($oh); + my $perm = $st[2]; + defined $perm or die "(f)stat failed on $pi_config: $!\n"; + chmod($perm & 07777, $fh) or + die "(f)chmod failed on future $pi_config: $!\n"; my $old; { local $/; |