From 687dd75c95f9212244b6cf4fe60b40db44de01ba Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Mon, 3 Apr 2006 23:41:09 -0700 Subject: 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 084c200..7d62477 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) { -- cgit v0.10.2-6-g49f6