shim: When in snapd mode, chdir to SNAP_USER_COMMON

This will alleviate some weird apparmor confinement denials when trying
to access the wrong directory.

Signed-off-by: Ikey Doherty <ikey@solus-project.com>
This commit is contained in:
Ikey Doherty
2017-12-24 18:10:35 +00:00
parent a1c2235120
commit e7eae9d577
+8
View File
@@ -17,6 +17,7 @@
#include <string.h>
#include "../common/files.h"
#include "config.h"
#include "lsi.h"
#include "shim.h"
@@ -38,6 +39,8 @@ int main(int argc, char **argv)
{
const char *operation_prefix = NULL;
const char *steam_binary = NULL;
__attribute__((unused)) const char *tdir = NULL;
__attribute__((unused)) int dir_ret = 0;
if (!shim_bootstrap()) {
return EXIT_FAILURE;
@@ -45,6 +48,7 @@ int main(int argc, char **argv)
#ifdef HAVE_SNAPD_SUPPORT
operation_prefix = getenv("SNAP");
tdir = getenv("SNAP_USER_COMMON");
#endif
steam_binary = shim_get_steam_binary(operation_prefix);
@@ -54,6 +58,10 @@ int main(int argc, char **argv)
return EXIT_FAILURE;
}
if (tdir) {
dir_ret = chdir(tdir);
}
return shim_execute(steam_binary, --argc, ++argv);
}