Skip to content

Commit 0178148

Browse files
authored
Bugfix: check for non-esistent file (see #450) (#458)
Signed-off-by: Henry Cox <[email protected]>
1 parent b988763 commit 0178148

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

lib/lcovutil.pm

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1331,7 +1331,14 @@ sub read_config($$)
13311331

13321332
my $set_value = 0;
13331333
info(1, "read_config: $filename\n");
1334-
if (exists($included_config_files{abs_path($filename)})) {
1334+
my $path = abs_path($filename);
1335+
if (!defined($path)) {
1336+
lcovutil::ignorable_error($lcovutil::ERROR_USAGE,
1337+
"config file '$filename' does not exist");
1338+
# as below - this line is unreachable because we can't ignore
1339+
# the message due to order of processing - see below.
1340+
return 0; # LCOV_UNREACHABLE_LINE
1341+
} elsif (exists($included_config_files{$path})) {
13351342
lcovutil::ignorable_error($lcovutil::ERROR_USAGE,
13361343
'config file inclusion loop detected: "' .
13371344
join('" -> "', @include_stack) .
@@ -1353,7 +1360,7 @@ sub read_config($$)
13531360
# described above.
13541361
return 0; # didn't set anything LCOV_UNREACHABLE_LINE
13551362
}
1356-
$included_config_files{abs_path($filename)} = 1;
1363+
$included_config_files{$path} = 1;
13571364
push(@include_stack, $filename);
13581365
VAR: while (<HANDLE>) {
13591366
chomp;
@@ -1407,7 +1414,7 @@ sub read_config($$)
14071414
}
14081415
}
14091416
close(HANDLE) or die("unable to close $filename: $!\n");
1410-
delete $included_config_files{abs_path($filename)};
1417+
delete $included_config_files{$path};
14111418
pop(@include_stack);
14121419
return $set_value;
14131420
}

0 commit comments

Comments
 (0)