From: Ben Pfaff Date: Tue, 30 Sep 2008 19:26:12 +0000 (-0700) Subject: Make ofp_error() preserve the value of errno. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0c7eb690076101d19e04d98df6d056dd73acb2c9;p=openvswitch Make ofp_error() preserve the value of errno. --- diff --git a/lib/util.c b/lib/util.c index 0c70710d..ff432561 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