commit: ed70de70a4e6833b261a484d64f46c5086485a4b
parent dda0ccc3b22f441bec530b1d7a0f158ffeef3f9c
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date: Thu, 28 Mar 2024 21:20:31 +0100
cmd/base64: check errno after fwrite instead of return value
fwrite on NetBSD at least manages to return 1 even in the case of a write error
Diffstat:
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/cmd/base64.c b/cmd/base64.c
@@ -104,7 +104,8 @@ encode(FILE *fin, const char *name)
}
assert(errno == 0);
- if(fwrite((char *)obuf, 4, 1, stdout) != 1)
+ fwrite((char *)obuf, 4, 1, stdout);
+ if(errno != 0)
{
fprintf(stderr, "base64: Error writing: %s\n", strerror(errno));
errno = 0;