summaryrefslogtreecommitdiff
path: root/src/core/namespace.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2013-12-13 02:05:04 +0100
committerLennart Poettering <lennart@poettering.net>2013-12-13 04:06:43 +0100
commit6b46ea73e3b1d8a1e65f58ac04772821bd4a72fb (patch)
tree5fe6a91a2bbb8e87528d68e7aeb2c58086d53d42 /src/core/namespace.c
parent6203e07a83214a55bb1f88508fcda2005c601dea (diff)
namespace: include boot id in private tmp directories
This way it is easy to only exclude directories from the current boot from automatic clean up in /var/tmp. Also, pick a longer name for the directories so that are globs in tmp.conf can be simpler yet equally accurate.
Diffstat (limited to 'src/core/namespace.c')
-rw-r--r--src/core/namespace.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/core/namespace.c b/src/core/namespace.c
index 926ff7133..85147be13 100644
--- a/src/core/namespace.c
+++ b/src/core/namespace.c
@@ -278,12 +278,22 @@ fail:
static int setup_one_tmp_dir(const char *id, const char *prefix, char **path) {
_cleanup_free_ char *x = NULL;
+ char bid[SD_ID128_STRING_MAX];
+ sd_id128_t boot_id;
+ int r;
assert(id);
assert(prefix);
assert(path);
- x = strjoin(prefix, "/systemd-", id, "-XXXXXX", NULL);
+ /* We include the boot id in the directory so that after a
+ * reboot we can easily identify obsolete directories. */
+
+ r = sd_id128_get_boot(&boot_id);
+ if (r < 0)
+ return r;
+
+ x = strjoin(prefix, "/systemd-private-", sd_id128_to_string(boot_id, bid), "-", id, "-XXXXXX", NULL);
if (!x)
return -ENOMEM;