Skip to content

Commit

Permalink
Freshclam, Sigtool, Clamconf: fix database line count if has empty lines
Browse files Browse the repository at this point in the history
Fixes: #1390
  • Loading branch information
micahsnyder committed Oct 30, 2024
1 parent 52b2017 commit 2e54498
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions common/misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,15 @@ unsigned int countlines(const char *filename)
return 0;

while (fgets(buff, sizeof(buff), fh)) {
// ignore comments
if (buff[0] == '#') continue;

// ignore empty lines in CR/LF format
if (buff[0] == '\r' && buff[1] == '\n') continue;

// ignore empty lines in LF format
if (buff[0] == '\n') continue;

lines++;
}

Expand Down

0 comments on commit 2e54498

Please sign in to comment.