From 24c691f645c2183edba20880dab7981277331cde Mon Sep 17 00:00:00 2001 From: Alexander Larsson Date: Wed, 24 Aug 2016 14:11:45 +0200 Subject: [PATCH] run: Mount /run/user/$uid/app/$appid in the sandbox This directory is shared between all instances of the app, as well as the host. In many ways this is similar to the ~/.var/app/$appid directory, but the directory is guaranteed to not be persistent (/run is on tmpfs), local to the host (not NFS), as well as nice support for features like locks and mmap (due to being tmpfs). --- common/flatpak-run.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/common/flatpak-run.c b/common/flatpak-run.c index b457ec21d..b14e6f210 100644 --- a/common/flatpak-run.c +++ b/common/flatpak-run.c @@ -1895,6 +1895,20 @@ flatpak_run_add_environment_args (GPtrArray *argv_array, } } + { + g_autofree char *run_user_app_dst = g_strdup_printf ("/run/user/%d/app/%s", getuid (), app_id); + g_autofree char *run_user_app_src = g_build_filename (g_get_user_runtime_dir (), "app", app_id, NULL); + + if (glnx_shutil_mkdir_p_at (AT_FDCWD, + run_user_app_src, + 0700, + NULL, + NULL)) + add_args (argv_array, + "--bind", run_user_app_src, run_user_app_dst, + NULL); + } + g_hash_table_iter_init (&iter, context->filesystems); while (g_hash_table_iter_next (&iter, &key, &value)) {