]> Sergey Matveev's repositories - public-inbox.git/blobdiff - script/public-inbox-init
update copyrights for 2018
[public-inbox.git] / script / public-inbox-init
index 739ec9e55530c3dacdc3c6e9e33df6b099e474a6..2f33c9efe67d1f689c47c62408efc6b8c3789d5c 100755 (executable)
@@ -1,6 +1,6 @@
 #!/usr/bin/perl -w
-# Copyright (C) 2014-2015 all contributors <meta@public-inbox.org>
-# License: AGPLv3 or later (https://www.gnu.org/licenses/agpl-3.0.txt)
+# Copyright (C) 2014-2018 all contributors <meta@public-inbox.org>
+# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
 #
 # Initializes a public-inbox, basically a wrapper for git-init(1)
 use strict;
@@ -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 $/;