From: Christian Franke Date: Tue, 10 Nov 2015 17:04:42 +0000 (+0100) Subject: lib: don't have log functions change errno X-Git-Tag: frr-2.0-rc1~398 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=d8efb772eb7adb2513a779a8bf247861c56f8eef;p=mirror%2Ffrr.git lib: don't have log functions change errno Signed-off-by: Christian Franke Acked-by: Donald Sharp (cherry picked from commit abfd40d68202882696260617729518a6d2c99302) --- 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 *