From: José Bollo Date: Wed, 28 Jun 2017 16:05:18 +0000 (+0200) Subject: Fix bad error reporting X-Git-Tag: dab/3.99.2^0 X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?p=src%2Fapp-framework-main.git;a=commitdiff_plain;h=f36bbef97187012b84f4620fea7cea440741981f Fix bad error reporting The use of %m was buggy due to the implementation of 'vverbose': it always returned ENOTTY Inappropriate ioctl for device Change-Id: I0b7dd4c2f4ce5a45611042a8b9ba3e6db0e60803 Signed-off-by: José Bollo --- diff --git a/src/verbose.c b/src/verbose.c index 6d0db01..3a0559e 100644 --- a/src/verbose.c +++ b/src/verbose.c @@ -52,6 +52,7 @@ void verbose_set_name(const char *name, int authority) #include #include #include +#include static char *appname; @@ -70,7 +71,9 @@ static const char *prefixes[] = { void vverbose(int level, const char *file, int line, const char *fmt, va_list args) { + int saverr = errno; int tty = isatty(fileno(stderr)); + errno = saverr; fprintf(stderr, "%s: ", prefixes[LEVEL(level)] + (tty ? 4 : 0)); vfprintf(stderr, fmt, args);