X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=pack-objects.c;h=7d6247791d9374986c6fb85159433ecd91b9ccec;hb=687dd75c95f9212244b6cf4fe60b40db44de01ba;hp=cde4afa798e093922f3e25738a65b6cc8f400fea;hpb=fb7a6531e67333b22967bf5b96ef22a28f3b2552;p=git.git diff --git a/pack-objects.c b/pack-objects.c index cde4afa7..7d624779 100644 --- a/pack-objects.c +++ b/pack-objects.c @@ -905,11 +905,22 @@ int main(int argc, char **argv) setup_progress_signal(); } - while (fgets(line, sizeof(line), stdin) != NULL) { + for (;;) { unsigned int hash; char *p; unsigned char sha1[20]; + if (!fgets(line, sizeof(line), stdin)) { + if (feof(stdin)) + break; + if (!ferror(stdin)) + die("fgets returned NULL, not EOF, not error!"); + if (errno != EINTR) + die("fgets: %s", strerror(errno)); + clearerr(stdin); + continue; + } + if (progress_update) { fprintf(stderr, "Counting objects...%d\r", nr_objects); progress_update = 0;