summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/libnm-std-aux/nm-std-aux.h8
1 files changed, 2 insertions, 6 deletions
diff --git a/src/libnm-std-aux/nm-std-aux.h b/src/libnm-std-aux/nm-std-aux.h
index 074c8a0b25..947ca36033 100644
--- a/src/libnm-std-aux/nm-std-aux.h
+++ b/src/libnm-std-aux/nm-std-aux.h
@@ -835,10 +835,8 @@ static inline void
_nm_auto_close(int *pfd)
{
if (*pfd >= 0) {
- int errsv = errno;
-
+ NM_AUTO_PROTECT_ERRNO(errsv);
(void) nm_close(*pfd);
- errno = errsv;
}
}
#define nm_auto_close nm_auto(_nm_auto_close)
@@ -847,10 +845,8 @@ static inline void
_nm_auto_fclose(FILE **pfd)
{
if (*pfd) {
- int errsv = errno;
-
+ NM_AUTO_PROTECT_ERRNO(errsv);
(void) fclose(*pfd);
- errno = errsv;
}
}
#define nm_auto_fclose nm_auto(_nm_auto_fclose)