summaryrefslogtreecommitdiff
path: root/src/shared
diff options
context:
space:
mode:
Diffstat (limited to 'src/shared')
-rw-r--r--src/shared/macro.h1
-rw-r--r--src/shared/util.c4
-rw-r--r--src/shared/util.h2
3 files changed, 7 insertions, 0 deletions
diff --git a/src/shared/macro.h b/src/shared/macro.h
index f8c5656538..c7ce7c87d0 100644
--- a/src/shared/macro.h
+++ b/src/shared/macro.h
@@ -191,5 +191,6 @@ static inline size_t IOVEC_INCREMENT(struct iovec *i, unsigned n, size_t k) {
#define _cleanup_fclose_ __attribute__((cleanup(fclosep)))
#define _cleanup_close_ __attribute__((cleanup(closep)))
#define _cleanup_closedir_ __attribute__((cleanup(closedirp)))
+#define _cleanup_umask_ __attribute__((cleanup(umaskp)))
#include "log.h"
diff --git a/src/shared/util.c b/src/shared/util.c
index add3fdce53..27b6683393 100644
--- a/src/shared/util.c
+++ b/src/shared/util.c
@@ -5827,3 +5827,7 @@ void closedirp(DIR **d) {
if (*d)
closedir(*d);
}
+
+void umaskp(mode_t *u) {
+ umask(*u);
+}
diff --git a/src/shared/util.h b/src/shared/util.h
index 2b75ba62f9..1a607cf37c 100644
--- a/src/shared/util.h
+++ b/src/shared/util.h
@@ -31,6 +31,7 @@
#include <signal.h>
#include <sched.h>
#include <limits.h>
+#include <sys/types.h>
#include <sys/stat.h>
#include <dirent.h>
#include <sys/resource.h>
@@ -533,3 +534,4 @@ void freep(void *p);
void fclosep(FILE **f);
void closep(int *fd);
void closedirp(DIR **d);
+void umaskp(mode_t *u);