mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-03-23 03:05:13 +08:00
Use ferror instead of checking errno to detect errors in read_file
glibc sets errno even though the file read did not have an error Fixes #1731
This commit is contained in:
parent
1665f84d60
commit
d7b3821c0a
@ -54,11 +54,10 @@ static void read_file(FILE *f, wcstring &b)
|
||||
{
|
||||
while (1)
|
||||
{
|
||||
errno=0;
|
||||
wint_t c = fgetwc(f);
|
||||
if (c == WEOF)
|
||||
{
|
||||
if (errno)
|
||||
if (ferror(f))
|
||||
{
|
||||
wperror(L"fgetwc");
|
||||
exit(1);
|
||||
|
Loading…
x
Reference in New Issue
Block a user