From: Junio C Hamano Date: Sun, 25 May 2008 08:23:55 +0000 (-0700) Subject: mailsplit: minor clean-up in read_line_with_nul() X-Git-Tag: v1.5.6-rc0~2^2 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=edc5594153d7246694c1ec5bdb8ccdaa97bf7daf;p=git.git mailsplit: minor clean-up in read_line_with_nul() Signed-off-by: Junio C Hamano --- diff --git a/builtin-mailsplit.c b/builtin-mailsplit.c index e4d977baf..ae2b4cb21 100644 --- a/builtin-mailsplit.c +++ b/builtin-mailsplit.c @@ -52,13 +52,12 @@ int read_line_with_nul(char *buf, int size, FILE *in) for (;;) { c = getc(in); + if (c == EOF) + break; buf[len++] = c; - if (c == EOF || c == '\n' || len + 1 >= size) + if (c == '\n' || len + 1 >= size) break; } - - if (c == EOF) - len--; buf[len] = '\0'; return len;