diff options
author | Thomas Haller <thaller@redhat.com> | 2015-03-05 09:28:41 (GMT) |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2015-03-05 09:30:24 (GMT) |
commit | 364ab3daf6d00dfa8e0dd81046f741e70cac5da9 (patch) | |
tree | 8eded0704fd6e3d5fdf25ec69d663e0c96dd3044 /include/netlink-private | |
parent | d8f080d94fa9cf5e977f8805446ac7ef39f82d31 (diff) | |
download | libnl-364ab3daf6d00dfa8e0dd81046f741e70cac5da9.zip libnl-364ab3daf6d00dfa8e0dd81046f741e70cac5da9.tar.gz libnl-364ab3daf6d00dfa8e0dd81046f741e70cac5da9.tar.bz2 |
dbg: save errno from modification in NL_DBG()
Evaluating the logging statement might overwrite the errno. Save and
restore it so that NL_DBG() preserves the errno.
Signed-off-by: Thomas Haller <thaller@redhat.com>
Diffstat (limited to 'include/netlink-private')
-rw-r--r-- | include/netlink-private/netlink.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/include/netlink-private/netlink.h b/include/netlink-private/netlink.h index 39f4dff..b06df8b 100644 --- a/include/netlink-private/netlink.h +++ b/include/netlink-private/netlink.h @@ -86,11 +86,14 @@ struct trans_list { #ifdef NL_DEBUG #define NL_DBG(LVL,FMT,ARG...) \ do { \ - if (LVL <= nl_debug) \ + if (LVL <= nl_debug) { \ + int _errsv = errno; \ fprintf(stderr, \ "DBG<" #LVL ">%20s:%-4u %s: " FMT, \ __FILE__, __LINE__, \ __PRETTY_FUNCTION__, ##ARG); \ + errno = _errsv; \ + } \ } while (0) #else /* NL_DEBUG */ #define NL_DBG(LVL,FMT,ARG...) do { } while(0) |