aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/test/perl/TestLib.pm21
1 files changed, 17 insertions, 4 deletions
diff --git a/src/test/perl/TestLib.pm b/src/test/perl/TestLib.pm
index fda6760226d..8a29740743e 100644
--- a/src/test/perl/TestLib.pm
+++ b/src/test/perl/TestLib.pm
@@ -261,8 +261,6 @@ sub check_mode_recursive
{
follow_fast => 1,
wanted => sub {
- my $file_stat = stat($File::Find::name);
-
# Is file in the ignore list?
foreach my $ignore ($ignore_list ? @{$ignore_list} : [])
{
@@ -272,8 +270,23 @@ sub check_mode_recursive
}
}
- defined($file_stat)
- or die("unable to stat $File::Find::name");
+ # Allow ENOENT. A running server can delete files, such as
+ # those in pg_stat. Other stat() failures are fatal.
+ my $file_stat = stat($File::Find::name);
+ unless (defined($file_stat))
+ {
+ my $is_ENOENT = $!{ENOENT};
+ my $msg = "unable to stat $File::Find::name: $!";
+ if ($is_ENOENT)
+ {
+ warn $msg;
+ return;
+ }
+ else
+ {
+ die $msg;
+ }
+ }
my $file_mode = S_IMODE($file_stat->mode);