mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-25 12:23:09 +00: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
1 changed files with 1 additions and 2 deletions
|
@ -54,11 +54,10 @@ static void read_file(FILE *f, wcstring &b)
|
||||||
{
|
{
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
errno=0;
|
|
||||||
wint_t c = fgetwc(f);
|
wint_t c = fgetwc(f);
|
||||||
if (c == WEOF)
|
if (c == WEOF)
|
||||||
{
|
{
|
||||||
if (errno)
|
if (ferror(f))
|
||||||
{
|
{
|
||||||
wperror(L"fgetwc");
|
wperror(L"fgetwc");
|
||||||
exit(1);
|
exit(1);
|
||||||
|
|
Loading…
Reference in a new issue