Skip to content

Commit

Permalink
safe_fgets() - even more anal fgets()
Browse files Browse the repository at this point in the history
This is from Linus -- the previous round forgot to clear error
after EINTR case.

Signed-off-by: Junio C Hamano <junkio@cox.net>
  • Loading branch information
Junio C Hamano committed Apr 4, 2006
1 parent da93d12 commit 687dd75
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions pack-objects.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 687dd75

Please sign in to comment.