aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosé Bollo <jose.bollo@iot.bzh>2017-06-28 18:05:18 +0200
committerJosé Bollo <jose.bollo@iot.bzh>2017-06-28 18:47:55 +0200
commitf36bbef97187012b84f4620fea7cea440741981f (patch)
tree2bd5e0d56e17cd8e2a4ef87d6f21f1f4ee2cfd56
parent941eb7ef734e7d6a9de9c7af13345e63f708d169 (diff)
Fix bad error reportingdab_3.99.2dab/3.99.23.99.2
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 <jose.bollo@iot.bzh>
-rw-r--r--src/verbose.c3
1 files changed, 3 insertions, 0 deletions
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 <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <errno.h>
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);