umask-util: add helper that resets umask until end of current code block
This commit is contained in:
+3
-6
@@ -2216,13 +2216,12 @@ static int copy_devnodes(const char *dest) {
|
||||
"tty\0"
|
||||
"net/tun\0";
|
||||
|
||||
_unused_ _cleanup_umask_ mode_t u;
|
||||
const char *d;
|
||||
int r = 0;
|
||||
|
||||
assert(dest);
|
||||
|
||||
u = umask(0000);
|
||||
BLOCK_WITH_UMASK(0000);
|
||||
|
||||
/* Create /dev/net, so that we can create /dev/net/tun in it */
|
||||
if (userns_mkdir(dest, "/dev/net", 0755, 0, 0) < 0)
|
||||
@@ -2299,11 +2298,10 @@ static int copy_devnodes(const char *dest) {
|
||||
}
|
||||
|
||||
static int make_extra_nodes(const char *dest) {
|
||||
_unused_ _cleanup_umask_ mode_t u;
|
||||
size_t i;
|
||||
int r;
|
||||
|
||||
u = umask(0000);
|
||||
BLOCK_WITH_UMASK(0000);
|
||||
|
||||
for (i = 0; i < arg_n_extra_nodes; i++) {
|
||||
_cleanup_free_ char *path = NULL;
|
||||
@@ -2500,12 +2498,11 @@ static int setup_kmsg(int kmsg_socket) {
|
||||
_cleanup_(unlink_and_freep) char *from = NULL;
|
||||
_cleanup_free_ char *fifo = NULL;
|
||||
_cleanup_close_ int fd = -1;
|
||||
_unused_ _cleanup_umask_ mode_t u;
|
||||
int r;
|
||||
|
||||
assert(kmsg_socket >= 0);
|
||||
|
||||
u = umask(0000);
|
||||
BLOCK_WITH_UMASK(0000);
|
||||
|
||||
/* We create the kmsg FIFO as as temporary file in /run, but immediately delete it after bind mounting it to
|
||||
* /proc/kmsg. While FIFOs on the reading side behave very similar to /proc/kmsg, their writing side behaves
|
||||
|
||||
Reference in New Issue
Block a user