Browse Source

builtin-grep: terminate correctly at EOF

It barfed and segfaulted with an incomplete line.

Signed-off-by: Junio C Hamano <junkio@cox.net>
maint
Junio C Hamano 19 years ago
parent
commit
7ed36f56e3
  1. 2
      builtin-grep.c

2
builtin-grep.c

@ -264,6 +264,8 @@ static int grep_buffer(struct grep_opt *opt, const char *name, @@ -264,6 +264,8 @@ static int grep_buffer(struct grep_opt *opt, const char *name,
}
*eol = ch;
bol = eol + 1;
if (!left)
break;
left--;
lno++;
}

Loading…
Cancel
Save