From f9f453994b6944005ee5e779eed34a3a32111c78 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Fri, 25 Jun 2021 09:48:13 +0200 Subject: [PATCH] glib-aux: use NM_AUTO_PROTECT_ERRNO() in nm_auto_close and nm_auto_fclose --- src/libnm-std-aux/nm-std-aux.h | 8 ++------ 1 file 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)