about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2023-03-20 19:16:21 -0400
committerRich Felker <dalias@aerifal.cx>2023-03-21 09:11:17 -0400
commit0e5234807dcdc76c43f9313c6ba9e2b7da408d8c (patch)
tree99ccf83b3bc4f2d145a779003406b0096f74ed81
parent868c96430093cd864512283b43071cb70b39b24e (diff)
downloadmusl-0e5234807dcdc76c43f9313c6ba9e2b7da408d8c.tar.gz
musl-0e5234807dcdc76c43f9313c6ba9e2b7da408d8c.tar.xz
musl-0e5234807dcdc76c43f9313c6ba9e2b7da408d8c.zip
in printf, use ferror macro rather than directly inspecting flags bit
this is purely aesthetic and should not affect code generation or
functionality.
-rw-r--r--src/stdio/vfprintf.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/stdio/vfprintf.c b/src/stdio/vfprintf.c
index 7b848080..a712d80f 100644
--- a/src/stdio/vfprintf.c
+++ b/src/stdio/vfprintf.c
@@ -132,7 +132,7 @@ static void pop_arg(union arg *arg, int type, va_list *ap)
 
 static void out(FILE *f, const char *s, size_t l)
 {
-	if (!(f->flags & F_ERR)) __fwritex((void *)s, l, f);
+	if (!ferror(f)) __fwritex((void *)s, l, f);
 }
 
 static void pad(FILE *f, char c, int w, int l, int fl)
@@ -693,7 +693,7 @@ int vfprintf(FILE *restrict f, const char *restrict fmt, va_list ap)
 		f->buf_size = 0;
 		f->wpos = f->wbase = f->wend = 0;
 	}
-	if (f->flags & F_ERR) ret = -1;
+	if (ferror(f)) ret = -1;
 	f->flags |= olderr;
 	FUNLOCK(f);
 	va_end(ap2);