nspawn: use automatic cleanup for umask

This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2012-09-16 16:20:09 +02:00
parent ed8b7a3ee5
commit 25ea79fe07
4 changed files with 28 additions and 46 deletions
+1
View File
@@ -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"
+4
View File
@@ -5827,3 +5827,7 @@ void closedirp(DIR **d) {
if (*d)
closedir(*d);
}
void umaskp(mode_t *u) {
umask(*u);
}
+2
View File
@@ -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);