X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fcore%2Fnamespace.c;h=85147be13017c0fab13f97c0d58291b7e17dab34;hb=d003f514dab2dbf1a66e11800a50aeaf039d036c;hp=092e08f72cfb64e393ac041ab670b5dc289eeb50;hpb=613b411c947635136637f8cdd66b94512f761eab;p=elogind.git diff --git a/src/core/namespace.c b/src/core/namespace.c index 092e08f72..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; @@ -354,9 +364,10 @@ int setup_netns(int netns_storage_socket[2]) { assert(netns_storage_socket[1] >= 0); /* We use the passed socketpair as a storage buffer for our - * namespace socket. Whatever process runs this first shall - * create a new namespace, all others should just join it. To - * serialize that we use a file lock on the socket pair. + * namespace reference fd. Whatever process runs this first + * shall create a new namespace, all others should just join + * it. To serialize that we use a file lock on the socket + * pair. * * It's a bit crazy, but hey, works great! */