unofficial mirror of meta@public-inbox.org
 help / color / mirror / Atom feed
From: Eric Wong <e@80x24.org>
To: meta@public-inbox.org
Subject: [PATCH 1/4] emergency: avoid needless mkpath dependency
Date: Sun, 19 Jun 2016 00:28:44 +0000	[thread overview]
Message-ID: <20160619002847.26685-2-e@80x24.org> (raw)
In-Reply-To: <20160619002847.26685-1-e@80x24.org>

Be more explicit and slightly speed up tests.
---
 lib/PublicInbox/Emergency.pm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/PublicInbox/Emergency.pm b/lib/PublicInbox/Emergency.pm
index e402d30..4ee8621 100644
--- a/lib/PublicInbox/Emergency.pm
+++ b/lib/PublicInbox/Emergency.pm
@@ -12,11 +12,11 @@ use IO::Handle;
 sub new {
 	my ($class, $dir) = @_;
 
+	-d $dir or mkdir($dir) or die "failed to mkdir($dir): $!\n";
 	foreach (qw(new tmp cur)) {
 		my $d = "$dir/$_";
 		next if -d $d;
-		require File::Path;
-		File::Path::mkpath($d); # croaks on fatal errors
+		-d $d or mkdir($d) or die "failed to mkdir($d): $!\n";
 	}
 	bless { dir => $dir, files => {}, t => 0, cnt => 0 }, $class;
 }

  reply	other threads:[~2016-06-19  0:28 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-19  0:28 [PATCH 0/4] watch improvements for mirroring Eric Wong
2016-06-19  0:28 ` Eric Wong [this message]
2016-06-19  0:28 ` [PATCH 2/4] watch_maildir: add scan test Eric Wong
2016-06-19  0:28 ` [PATCH 3/4] watch_maildir: spam removal support Eric Wong
2016-06-19  0:28 ` [PATCH 4/4] import: allow messages without subject Eric Wong
2016-06-19  3:44 ` [PATCH 5/4] watch_maildir: tighten up path checks Eric Wong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://public-inbox.org/README

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160619002847.26685-2-e@80x24.org \
    --to=e@80x24.org \
    --cc=meta@public-inbox.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).