Let signals interrupt fgets unless SA_RESTART set (#1152)

This commit is contained in:
Cadence Ember 2024-05-04 02:49:41 +12:00 committed by GitHub
parent 181cd4cbe8
commit 8f6bc9dabc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 139 additions and 5 deletions

View file

@ -57,11 +57,7 @@ char *fgets_unlocked(char *s, int size, FILE *f) {
break;
} else {
if ((c = fgetc_unlocked(f)) == -1) {
if (ferror_unlocked(f) == EINTR) {
continue;
} else {
break;
}
break;
}
*p++ = c & 255;
if (c == '\n')