From d8efb772eb7adb2513a779a8bf247861c56f8eef Mon Sep 17 00:00:00 2001 From: Christian Franke Date: Tue, 10 Nov 2015 18:04:42 +0100 Subject: [PATCH] lib: don't have log functions change errno Signed-off-by: Christian Franke Acked-by: Donald Sharp (cherry picked from commit abfd40d68202882696260617729518a6d2c99302) --- lib/log.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/log.c b/lib/log.c index 453a611dcd..ea50ae18cc 100644 --- a/lib/log.c +++ b/lib/log.c @@ -179,6 +179,7 @@ static void vzlog (struct zlog *zl, int priority, const char *format, va_list args) { char proto_str[32]; + int original_errno = errno; struct timestamp_control tsctl; tsctl.already_rendered = 0; @@ -197,6 +198,7 @@ vzlog (struct zlog *zl, int priority, const char *format, va_list args) fflush (stderr); /* In this case we return at here. */ + errno = original_errno; return; } tsctl.precision = zl->timestamp_precision; @@ -249,6 +251,8 @@ vzlog (struct zlog *zl, int priority, const char *format, va_list args) if (priority <= zl->maxlvl[ZLOG_DEST_MONITOR]) vty_log ((zl->record_priority ? zlog_priority[priority] : NULL), proto_str, format, &tsctl, args); + + errno = original_errno; } static char * -- 2.39.5