about summary refs log tree commit homepage
path: root/script/public-inbox-init
diff options
context:
space:
mode:
Diffstat (limited to 'script/public-inbox-init')
-rwxr-xr-xscript/public-inbox-init16
1 files changed, 3 insertions, 13 deletions
diff --git a/script/public-inbox-init b/script/public-inbox-init
index c775eb31..7ac77830 100755
--- a/script/public-inbox-init
+++ b/script/public-inbox-init
@@ -100,11 +100,7 @@ if (-e $pi_config) {
         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 $/;
-                $old = <$oh>;
-        }
+        defined(my $old = do { local $/; <$oh> }) or die "read $pi_config: $!\n";
         print $fh $old or die "failed to write: $!\n";
         close $oh or die "failed to close $pi_config: $!\n";
 
@@ -138,10 +134,9 @@ close($fh) or die "failed to close $pi_config_tmp: $!\n";
 my $pfx = "publicinbox.$name";
 my @x = (qw/git config/, "--file=$pi_config_tmp");
 
-require File::Spec;
-$inboxdir = File::Spec->canonpath($inboxdir);
+$inboxdir = PublicInbox::Config::rel2abs_collapsed($inboxdir);
+die "`\\n' not allowed in `$inboxdir'\n" if index($inboxdir, "\n") >= 0;
 
-die "`\\n' not allowed in `$inboxdir'\n" if $inboxdir =~ /\n/s;
 if (-f "$inboxdir/inbox.lock") {
         if (!defined $version) {
                 $version = 2;
@@ -186,11 +181,6 @@ if ($skip_docdata) {
         $ibx->{-skip_docdata} = $skip_docdata;
 }
 $ibx->init_inbox(0, $skip_epoch, $skip_artnum);
-require Cwd;
-my $tmp = Cwd::abs_path($inboxdir);
-defined($tmp) or die "failed to resolve $inboxdir: $!\n";
-$inboxdir = $tmp;
-die "`\\n' not allowed in `$inboxdir'\n" if $inboxdir =~ /\n/s;
 
 # needed for git prior to v2.1.0
 umask(0077) if defined $perm;