summaryrefslogtreecommitdiff
path: root/common/flatpak-run.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2018-12-16 22:36:33 -0500
committerAtomic Bot <atomic-devel@projectatomic.io>2018-12-17 08:14:43 +0000
commit2a8a0ec69af533fb9f4b617833ab54c53b9ffa78 (patch)
treeb21ea04d5d0b9734424e7ab1c7c14549c27e85b5 /common/flatpak-run.c
parentd13211f5e6fd45e5b0c2e3304e49d510ab45899e (diff)
downloadflatpak-2a8a0ec69af533fb9f4b617833ab54c53b9ffa78.tar.gz
Pass host xdg dirs into the sandbox
There are some use cases where apps might legitimately need to know the host values of xdg variables. Since we use them for our own purposes, we can't just propagate them as-is. Instead, set HOST_XDG_{DATA,CONFIG,CACHE}_HOME if the corresponding xdg variables are set on the host. Closes: #2424 Closes: #2440 Approved by: alexlarsson
Diffstat (limited to 'common/flatpak-run.c')
-rw-r--r--common/flatpak-run.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/common/flatpak-run.c b/common/flatpak-run.c
index 09dd46b3..80aa4d59 100644
--- a/common/flatpak-run.c
+++ b/common/flatpak-run.c
@@ -1318,6 +1318,13 @@ flatpak_run_apply_env_appid (FlatpakBwrap *bwrap,
flatpak_bwrap_set_env (bwrap, "XDG_DATA_HOME", flatpak_file_get_path_cached (app_dir_data), TRUE);
flatpak_bwrap_set_env (bwrap, "XDG_CONFIG_HOME", flatpak_file_get_path_cached (app_dir_config), TRUE);
flatpak_bwrap_set_env (bwrap, "XDG_CACHE_HOME", flatpak_file_get_path_cached (app_dir_cache), TRUE);
+
+ if (g_getenv ("XDG_DATA_HOME"))
+ flatpak_bwrap_set_env (bwrap, "HOST_XDG_DATA_HOME", g_getenv ("XDG_DATA_HOME"), TRUE);
+ if (g_getenv ("XDG_CONFIG_HOME"))
+ flatpak_bwrap_set_env (bwrap, "HOST_XDG_CONFIG_HOME", g_getenv ("XDG_CONFIG_HOME"), TRUE);
+ if (g_getenv ("XDG_CACHE_HOME"))
+ flatpak_bwrap_set_env (bwrap, "HOST_XDG_CACHE_HOME", g_getenv ("XDG_CACHE_HOME"), TRUE);
}
void