Skip to content

Commit

Permalink
Merge pull request #1397 from micahsnyder/CLAM-2711-freshclam-sigtool…
Browse files Browse the repository at this point in the history
…-clamconf-countlines-empty-lines

Freshclam, Sigtool, Clamconf: fix database line count if has empty lines
  • Loading branch information
micahsnyder authored Jan 12, 2025
2 parents 73ee315 + 2e54498 commit 7f60cc7
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 7f60cc7

Please sign in to comment.