@matheusbsbs / matheus-bagliano / commits / 687dd75c95
Fork 0

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 <junkio@cox.net>

Junio C Hamano committed Apr 3, 2006 at 23:41 UTC 687dd75c95f9212244b6cf4fe60b40db44de01ba
1 file changed +4 -3
pack-objects.c
+4 -3
@@ -915,9 +915,10 @@ int main(int argc, char **argv)
915 break;
916 if (!ferror(stdin))
917 die("fgets returned NULL, not EOF, not error!");
918 - if (errno == EINTR)
919 - continue;
920 - die("fgets: %s", strerror(errno));
918 + if (errno != EINTR)
919 + die("fgets: %s", strerror(errno));
920 + clearerr(stdin);
921 + continue;
922 }
923
924 if (progress_update) {