diff options
Diffstat (limited to 'usr.bin/grep')
-rw-r--r-- | usr.bin/grep/grep.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/usr.bin/grep/grep.c b/usr.bin/grep/grep.c index b85db5a..fe8c778 100644 --- a/usr.bin/grep/grep.c +++ b/usr.bin/grep/grep.c @@ -315,8 +315,12 @@ read_patterns(const char *fn) } len = 0; line = NULL; - while ((rlen = getline(&line, &len, f)) != -1) + while ((rlen = getline(&line, &len, f)) != -1) { + if (line[0] == '\0') + continue; add_pattern(line, line[0] == '\n' ? 0 : (size_t)rlen); + } + free(line); if (ferror(f)) err(2, "%s", fn); |