summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2024-04-06 17:11:19 -0300
committerEuAndreh <eu@euandre.org>2024-04-06 17:11:19 -0300
commit75efbb9fe1afb074a3e680d5042e1d96c63ea8d4 (patch)
tree69a2a949c169de01a0cbf19dbd7c247ffb6cd5d8
parentsrc/: Check "if (x != NULL)" instead of "if (x)" (diff)
downloadpindaiba-75efbb9fe1afb074a3e680d5042e1d96c63ea8d4.tar.gz
pindaiba-75efbb9fe1afb074a3e680d5042e1d96c63ea8d4.tar.xz
src/logerr.c: Also *try* to log something when fprintf() and vfprintf() fail
-rw-r--r--src/logerr.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/logerr.c b/src/logerr.c
index 6fddcb9..f6b3d46 100644
--- a/src/logerr.c
+++ b/src/logerr.c
@@ -16,11 +16,15 @@ vlogerr(
const char *restrict format,
...
) {
- (void)fprintf(stream, "%s:%s:%d: ", file, function, lineno);
+ if (fprintf(stream, "%s:%s:%d: ", file, function, lineno) < 0) {
+ perror(__FILE__ ":vlogerr(): fprintf() < 0");
+ }
va_list args;
va_start(args, format);
- (void)vfprintf(stream, format, args);
+ if (vfprintf(stream, format, args) < 0) {
+ perror(__FILE__ ":vlogerr(): vfprintf() < 0");
+ }
va_end(args);
return;