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

This commit is contained in:
Thomas Haller 2021-06-25 09:48:13 +02:00
parent 2b55408cc7
commit f9f453994b
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728

View file

@ -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)