glib-aux: use NM_AUTO_PROTECT_ERRNO() in nm_auto_close and nm_auto_fclose

(cherry picked from commit f9f453994b)
This commit is contained in:
Thomas Haller 2021-06-25 09:48:13 +02:00
parent 309eba1078
commit 29d64f148e
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728

View file

@ -709,10 +709,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)
@ -721,10 +719,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)