From: Junio C Hamano Date: Tue, 4 Apr 2006 06:41:09 +0000 (-0700) Subject: safe_fgets() - even more anal fgets() X-Git-Tag: v1.2.5~1 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=687dd75c95f9212244b6cf4fe60b40db44de01ba;p=git.git safe_fgets() - even more anal fgets() This is from Linus -- the previous round forgot to clear error after EINTR case. Signed-off-by: Junio C Hamano --- diff --git a/pack-objects.c b/pack-objects.c index 084c2006..7d624779 100644 --- a/pack-objects.c +++ b/pack-objects.c @@ -915,9 +915,10 @@ int main(int argc, char **argv) break; if (!ferror(stdin)) die("fgets returned NULL, not EOF, not error!"); - if (errno == EINTR) - continue; - die("fgets: %s", strerror(errno)); + if (errno != EINTR) + die("fgets: %s", strerror(errno)); + clearerr(stdin); + continue; } if (progress_update) {