commit 06bb458374ba9a9e88a7c1ade9f00c3290981d26
parent fd900052a71824adf321d6c11bfe3398105e3da5
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Wed, 19 Aug 2020 19:11:41 +0200
revert back to using vfprintf and fprintf + a fflush
dprintf and vdprintf is in "recent" POSIX (2008), but it is not supported on
some distributions.
Just use vfprintf and fprintf + a fflush. This is a bit more ugly, but not
performance-critical code or anything.
Diffstat:
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/sfeed_curses.c b/sfeed_curses.c
@@ -173,8 +173,9 @@ ttywritef(const char *fmt, ...)
int n;
va_start(ap, fmt);
- n = vdprintf(1, fmt, ap);
+ n = vfprintf(stdout, fmt, ap);
va_end(ap);
+ fflush(stdout);
return n;
}
@@ -198,11 +199,12 @@ die(const char *fmt, ...)
cleanup();
va_start(ap, fmt);
- vdprintf(2, fmt, ap);
+ vfprintf(stderr, fmt, ap);
va_end(ap);
if (saved_errno)
- dprintf(2, ": %s", strerror(saved_errno));
+ fprintf(stderr, ": %s", strerror(saved_errno));
+ fflush(stderr);
write(2, "\n", 1);
_exit(1);