platform: preserve errno in nm_auto_pop_netns

This commit is contained in:
Thomas Haller
2016-12-09 09:29:27 +01:00
parent ed299cc860
commit ccf766f659

View File

@@ -53,8 +53,12 @@ int nmp_netns_get_fd_mnt (NMPNetns *self);
static inline void
_nm_auto_pop_netns (NMPNetns **p)
{
if (*p)
if (*p) {
int errsv = errno;
nmp_netns_pop (*p);
errno = errsv;
}
}
#define nm_auto_pop_netns __attribute__((cleanup(_nm_auto_pop_netns)))