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>
This commit is contained in:
Junio C Hamano 2006-04-03 23:41:09 -07:00
Родитель da93d12b00
Коммит 687dd75c95
1 изменённых файлов: 4 добавлений и 3 удалений

Просмотреть файл

@ -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) {