From 21d279cf543c82705a5b3362818805603d2ab9f2 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Wed, 15 Feb 2012 04:56:59 +0100 Subject: [PATCH] namespace: temporaily reset umask when creating private /tmp --- src/namespace.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/namespace.c b/src/namespace.c index a06cac10..09bc8290 100644 --- a/src/namespace.c +++ b/src/namespace.c @@ -253,11 +253,19 @@ int setup_namespace( } if (need_private) { + mode_t u; + memcpy(private_dir, tmp_dir, sizeof(tmp_dir)-1); + + u = umask(0000); if (mkdir(private_dir, 0777 + S_ISVTX) < 0) { + umask(u); + r = -errno; goto fail; } + + umask(u); remove_private = true; } -- 2.39.5