summary refs log tree commit diff
path: root/shared/nm-std-aux
diff options
context:
space:
mode:
Diffstat (limited to 'shared/nm-std-aux')
-rw-r--r--shared/nm-std-aux/nm-std-aux.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/shared/nm-std-aux/nm-std-aux.h b/shared/nm-std-aux/nm-std-aux.h
index 30adeb58..a619cebd 100644
--- a/shared/nm-std-aux/nm-std-aux.h
+++ b/shared/nm-std-aux/nm-std-aux.h
@@ -695,6 +695,14 @@ nm_close(int fd)
 NM_AUTO_DEFINE_FCN_VOID0(void *, _nm_auto_free_impl, free);
 #define nm_auto_free nm_auto(_nm_auto_free_impl)
 
+static inline void
+_nm_auto_protect_errno(const int *p_saved_errno)
+{
+    errno = *p_saved_errno;
+}
+#define NM_AUTO_PROTECT_ERRNO(errsv_saved) \
+    nm_auto(_nm_auto_protect_errno) _nm_unused const int errsv_saved = (errno)
+
 /*****************************************************************************/
 
 static inline void