From 0c7eb690076101d19e04d98df6d056dd73acb2c9 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Tue, 30 Sep 2008 12:26:12 -0700 Subject: [PATCH] Make ofp_error() preserve the value of errno. --- lib/util.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/util.c b/lib/util.c index 0c70710dd..ff4325616 100644 --- a/lib/util.c +++ b/lib/util.c @@ -33,6 +33,7 @@ #include #include "util.h" +#include #include #include #include @@ -138,6 +139,7 @@ ofp_fatal(int err_no, const char *format, ...) void ofp_error(int err_no, const char *format, ...) { + int save_errno = errno; va_list args; fprintf(stderr, "%s: ", program_name); @@ -147,6 +149,8 @@ ofp_error(int err_no, const char *format, ...) if (err_no != 0) fprintf(stderr, " (%s)", strerror(err_no)); putc('\n', stderr); + + errno = save_errno; } /* Sets program_name based on 'argv0'. Should be called at the beginning of -- 2.43.0