aboutsummaryrefslogtreecommitdiffhomepage
path: root/fish_indent.cpp
diff options
context:
space:
mode:
authorGravatar ridiculousfish <corydoras@ridiculousfish.com>2014-10-04 14:27:08 -0700
committerGravatar ridiculousfish <corydoras@ridiculousfish.com>2014-10-04 14:28:26 -0700
commitd7b3821c0aa6402a89dd10f1e47e58524a8fe977 (patch)
tree271240391f7edb9d94affb9f33504017f6a6218d /fish_indent.cpp
parent1665f84d60ea136dfe581513310b68d36a6d1a8b (diff)
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
Diffstat (limited to 'fish_indent.cpp')
-rw-r--r--fish_indent.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/fish_indent.cpp b/fish_indent.cpp
index 1332db5e..21ffd47f 100644
--- a/fish_indent.cpp
+++ b/fish_indent.cpp
@@ -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);