bsdgrep: Handle special case of single-byte NUL pattern

PR:		202022
Submitted by:	Kyle Evans <kevans91 at ksu.edu>
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D10102
This commit is contained in:
Ed Maste 2017-04-05 20:11:05 +00:00
parent 6916de8666
commit d204af1e41
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=316542

View File

@ -314,8 +314,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);