summaryrefslogtreecommitdiff
authorLennart Poettering <lennart@poettering.net>2012-02-15 03:56:59 (GMT)
committer Lennart Poettering <lennart@poettering.net>2012-02-15 04:00:54 (GMT)
commit21d279cf543c82705a5b3362818805603d2ab9f2 (patch) (side-by-side diff)
treefdf35e7864cd3f92bb0e3d0944e2ddbf53744707
parentfc8af9ff3fbbbf21bf26f21d2eb100f26afc201a (diff)
downloadsystemd-21d279cf543c82705a5b3362818805603d2ab9f2.zip
systemd-21d279cf543c82705a5b3362818805603d2ab9f2.tar.gz
namespace: temporaily reset umask when creating private /tmp
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--src/namespace.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/namespace.c b/src/namespace.c
index a06cac1..09bc829 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;
}