diff options
author | Thomas Haller <thaller@redhat.com> | 2017-02-21 11:32:47 +0100 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2017-02-21 11:46:23 +0100 |
commit | 19c9d1bafda1ff7eb75a96b4eebc5b8544f06137 (patch) | |
tree | cbe94f6c269a33e1077d1ba442c64bbd182a18f0 | |
parent | 7e79e913ad11e2c9247e840cd5cc5b2eccce25ab (diff) | |
download | NetworkManager-19c9d1bafda1ff7eb75a96b4eebc5b8544f06137.tar.gz |
ifcfg: add nm_auto_shvar_file_close cleanup macro
-rw-r--r-- | src/settings/plugins/ifcfg-rh/shvar.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/settings/plugins/ifcfg-rh/shvar.h b/src/settings/plugins/ifcfg-rh/shvar.h index a6498fcea2..3b35e30d1f 100644 --- a/src/settings/plugins/ifcfg-rh/shvar.h +++ b/src/settings/plugins/ifcfg-rh/shvar.h @@ -87,4 +87,16 @@ void svCloseFile (shvarFile *s); const char *svEscape (const char *s, char **to_free); const char *svUnescape (const char *s, char **to_free); +static inline void +_nm_auto_shvar_file_close (shvarFile **p_s) +{ + if (*p_s) { + int errsv = errno; + + svCloseFile (*p_s); + errno = errsv; + } +} +#define nm_auto_shvar_file_close nm_auto(_nm_auto_shvar_file_close) + #endif /* _SHVAR_H */ |