aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosé Bollo <jose.bollo@iot.bzh>2017-06-28 18:08:29 +0200
committerJosé Bollo <jose.bollo@iot.bzh>2017-06-29 22:10:38 +0200
commit17e428f46f0e093270be7eff79788e1575bcfb14 (patch)
tree4370d492bb24fd4749fcba9792e452b53e99dd63
parentbe584a083ec37786e2e16cd8483fb447b565df1e (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: Idedeefa44ec3cf301d75cd542c54c35a208886a1 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 5b2611a7..2b009073 100644
--- a/src/verbose.c
+++ b/src/verbose.c
@@ -77,6 +77,7 @@ void verbose_set_name(const char *name, int authority)
#else
#include <unistd.h>
+#include <errno.h>
static const char *appname;
@@ -95,7 +96,9 @@ static const char *prefixes[] = {
void vverbose(int level, const char *file, int line, const char *function, 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);