enh(protocol/snmp): collection mode - config option with carriage return (#2996)

This commit is contained in:
qgarnier 2021-07-29 14:23:28 +02:00 committed by GitHub
parent f2476711df
commit 47c8a21840
1 changed files with 3 additions and 3 deletions

View File

@ -153,7 +153,9 @@ sub read_config {
my ($self, %options) = @_;
my $content;
if (-f $self->{option_results}->{config}) {
if ($self->{option_results}->{config} =~ /\n/m || ! -f "$self->{option_results}->{config}") {
$content = $self->{option_results}->{config};
} else {
$content = do {
local $/ = undef;
if (!open my $fh, '<', $self->{option_results}->{config}) {
@ -162,8 +164,6 @@ sub read_config {
}
<$fh>;
};
} else {
$content = $self->{option_results}->{config};
}
eval {