Merge pull request #150 from tmancill/perl-issue-20103

Don't try to open a directory as the config file
This commit is contained in:
Duncan Ferguson 2023-06-11 11:39:50 +01:00 committed by GitHub
commit 618602f496
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View file

@ -314,7 +314,7 @@ sub load_configs {
$ENV{HOME} . '/.clusterssh/config',
)
{
$self->parse_config_file($config) if ( -e $config );
$self->parse_config_file($config) if ( -e $config && ! -d _ );
}
# write out default config file if necesasry
@ -329,10 +329,10 @@ sub load_configs {
# relative to config directory
for my $config (@configs) {
next unless ($config); # can be null when passed from Getopt::Long
$self->parse_config_file($config) if ( -e $config );
$self->parse_config_file($config) if ( -e $config && ! -d _ );
my $file = $ENV{HOME} . '/.clusterssh/config_' . $config;
$self->parse_config_file($file) if ( -e $file );
$self->parse_config_file($file) if ( -e $file && ! -d _ );
}
return $self;

View file

@ -535,7 +535,7 @@ SKIP: {
chmod( 0755, $ENV{HOME} . '/.csshrc.DISABLED', $ENV{HOME} );
}
note('check failure to write default config is caught');
note('check failure to write default config is caught when loading config');
$ENV{HOME} = tempdir( CLEANUP => 1 );
mkdir( $ENV{HOME} . '/.clusterssh' );
mkdir( $ENV{HOME} . '/.clusterssh/config' );