summaryrefslogtreecommitdiff
path: root/src/shared
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2013-10-03 22:13:55 -0400
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2013-10-03 22:13:55 -0400
commit5862d652ba14178cff46b8a8fc6c6d8392bf32b1 (patch)
treeb5f526c49e7aa8f5115fd59faecac865bdefce22 /src/shared
parent9a5cb1371b6d8b0a04bd08665bcf9b06cb40c64c (diff)
Introduce _cleanup_endmntent_
Diffstat (limited to 'src/shared')
-rw-r--r--src/shared/util.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/shared/util.h b/src/shared/util.h
index c2e6a685c8..c9d078257f 100644
--- a/src/shared/util.h
+++ b/src/shared/util.h
@@ -39,6 +39,7 @@
#include <stddef.h>
#include <unistd.h>
#include <locale.h>
+#include <mntent.h>
#include "macro.h"
#include "time-util.h"
@@ -578,6 +579,11 @@ static inline void umaskp(mode_t *u) {
umask(*u);
}
+static inline void endmntentp(FILE **f) {
+ if (*f)
+ endmntent(*f);
+}
+
#define _cleanup_free_ _cleanup_(freep)
#define _cleanup_fclose_ _cleanup_(fclosep)
#define _cleanup_pclose_ _cleanup_(pclosep)
@@ -585,6 +591,7 @@ static inline void umaskp(mode_t *u) {
#define _cleanup_closedir_ _cleanup_(closedirp)
#define _cleanup_umask_ _cleanup_(umaskp)
#define _cleanup_globfree_ _cleanup_(globfree)
+#define _cleanup_endmntent_ _cleanup_(endmntentp)
_malloc_ _alloc_(1, 2) static inline void *malloc_multiply(size_t a, size_t b) {
if (_unlikely_(b == 0 || a > ((size_t) -1) / b))