Browse Source

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>
maint
Junio C Hamano 19 years ago
parent
commit
687dd75c95
  1. 5
      pack-objects.c

5
pack-objects.c

@ -915,9 +915,10 @@ int main(int argc, char **argv)
break; break;
if (!ferror(stdin)) if (!ferror(stdin))
die("fgets returned NULL, not EOF, not error!"); die("fgets returned NULL, not EOF, not error!");
if (errno == EINTR) if (errno != EINTR)
continue;
die("fgets: %s", strerror(errno)); die("fgets: %s", strerror(errno));
clearerr(stdin);
continue;
} }


if (progress_update) { if (progress_update) {

Loading…
Cancel
Save