summaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorMichal Sekletar <msekleta@redhat.com>2013-03-14 18:12:27 +0100
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2013-03-15 22:56:40 -0400
commitc17ec25e4d9bd6c8e8617416f813e25b2ebbafc5 (patch)
tree6a414a30460e6a362180a059bc93e88cea946916 /src/test
parent3b953d68c628c6ae70adba871719ac0f16083b51 (diff)
core: reuse the same /tmp, /var/tmp and inaccessible dir
All Execs within the service, will get mounted the same /tmp and /var/tmp directories, if service is configured with PrivateTmp=yes. Temporary directories are cleaned up by service itself in addition to systemd-tmpfiles. Directory which is mounted as inaccessible is created at runtime in /run/systemd.
Diffstat (limited to 'src/test')
-rw-r--r--src/test/test-ns.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/test/test-ns.c b/src/test/test-ns.c
index b1c759fc20..ad0d0419c4 100644
--- a/src/test/test-ns.c
+++ b/src/test/test-ns.c
@@ -26,6 +26,7 @@
#include <linux/fs.h>
#include "namespace.h"
+#include "execute.h"
#include "log.h"
int main(int argc, char *argv[]) {
@@ -47,8 +48,19 @@ int main(int argc, char *argv[]) {
};
int r;
+ char tmp_dir[] = "/tmp/systemd-private-XXXXXX",
+ var_tmp_dir[] = "/var/tmp/systemd-private-XXXXXX";
- r = setup_namespace((char**) writable, (char**) readonly, (char**) inaccessible, true, 0);
+ assert_se(mkdtemp(tmp_dir));
+ assert_se(mkdtemp(var_tmp_dir));
+
+ r = setup_namespace((char **) writable,
+ (char **) readonly,
+ (char **) inaccessible,
+ tmp_dir,
+ var_tmp_dir,
+ true,
+ 0);
if (r < 0) {
log_error("Failed to setup namespace: %s", strerror(-r));
return 1;