From: Joey Hess Date: Thu, 17 Jun 2010 20:54:03 +0000 (-0400) Subject: avoid dying if cannot chdir to an underlaydir X-Git-Tag: 3.20100623~44 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=cb4b99929757f970d5ae697f0d09514ad624ed46;p=ikiwiki.git avoid dying if cannot chdir to an underlaydir --- diff --git a/IkiWiki/Plugin/autoindex.pm b/IkiWiki/Plugin/autoindex.pm index 5e8a9e0a3..c3eb53300 100644 --- a/IkiWiki/Plugin/autoindex.pm +++ b/IkiWiki/Plugin/autoindex.pm @@ -39,7 +39,7 @@ sub refresh () { my (%pages, %dirs); foreach my $dir ($config{srcdir}, @{$config{underlaydirs}}, $config{underlaydir}) { - chdir($dir) || die "chdir: $!"; + chdir($dir) || next; find({ no_chdir => 1, @@ -64,7 +64,7 @@ sub refresh () { } }, '.'); - chdir($origdir) || die "chdir: $!"; + chdir($origdir) || die "chdir $origdir: $!"; } my %deleted; diff --git a/IkiWiki/Plugin/comments.pm b/IkiWiki/Plugin/comments.pm index 17cd99c3b..d1558001a 100644 --- a/IkiWiki/Plugin/comments.pm +++ b/IkiWiki/Plugin/comments.pm @@ -669,7 +669,7 @@ sub comments_pending () { my $extension=shift; return unless -d $dir; - chdir($dir) || die "chdir: $!"; + chdir($dir) || die "chdir $dir: $!"; find({ no_chdir => 1, @@ -686,7 +686,7 @@ sub comments_pending () { } }, "."); - chdir($origdir) || die "chdir: $!"; + chdir($origdir) || die "chdir $origdir: $!"; }; $find_comments->($config{srcdir}, "._comment_pending"); diff --git a/IkiWiki/Render.pm b/IkiWiki/Render.pm index c6167b437..aae1f90b0 100644 --- a/IkiWiki/Render.pm +++ b/IkiWiki/Render.pm @@ -335,21 +335,22 @@ sub find_src_files () { } }; - chdir($config{srcdir}) || die "chdir: $!"; + chdir($config{srcdir}) || die "chdir $config{srcdir}: $!"; find({ no_chdir => 1, wanted => $helper, }, '.'); - chdir($origdir) || die "chdir: $!"; + chdir($origdir) || die "chdir $origdir: $!"; $underlay=1; foreach (@{$config{underlaydirs}}, $config{underlaydir}) { - chdir($_) || die "chdir: $!"; - find({ - no_chdir => 1, - wanted => $helper, - }, '.'); - chdir($origdir) || die "chdir: $!"; + if (chdir($_)) { + find({ + no_chdir => 1, + wanted => $helper, + }, '.'); + chdir($origdir) || die "chdir: $!"; + } }; return \@files, \%pages;