Update copyright
[src/app-framework-main.git] / src / verbose.c
index 6d0db01..e60ba54 100644 (file)
@@ -1,5 +1,5 @@
 /*
- Copyright (C) 2016, 2017 "IoT.bzh"
+ Copyright (C) 2015-2020 "IoT.bzh"
 
  author: José Bollo <jose.bollo@iot.bzh>
 
@@ -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);