summaryrefslogtreecommitdiff
path: root/common/flatpak-exports.c
diff options
context:
space:
mode:
authorSimon McVittie <smcv@collabora.com>2020-01-20 18:53:44 +0000
committerAlexander Larsson <alexander.larsson@gmail.com>2020-02-14 15:41:59 +0100
commitb34ccef1c0cc708e729ec966350e3bc018f1f709 (patch)
tree1701eedca16eedb221e26b093f829a8e0e5991a5 /common/flatpak-exports.c
parent66aee5a34266acb9d6cb38c5a83a0612d10e9b6f (diff)
downloadflatpak-b34ccef1c0cc708e729ec966350e3bc018f1f709.tar.gz
common: Unify some lists of /usr-merged directories
In some places we want a list of basenames, and in others we want a list of absolute paths. Use the absolute paths, because converting those into basenames doesn't require memory allocation. Signed-off-by: Simon McVittie <smcv@collabora.com>
Diffstat (limited to 'common/flatpak-exports.c')
-rw-r--r--common/flatpak-exports.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/common/flatpak-exports.c b/common/flatpak-exports.c
index 31dd7835..8c662a87 100644
--- a/common/flatpak-exports.c
+++ b/common/flatpak-exports.c
@@ -49,9 +49,11 @@
#include "flatpak-error.h"
/* We don't want to export paths pointing into these, because they are readonly
- (so we can't create mountpoints there) and don't match what's on the host anyway */
+ (so we can't create mountpoints there) and don't match what's on the host anyway.
+ flatpak_abs_usrmerged_dirs get the same treatment without having to be listed
+ here. */
const char *dont_export_in[] = {
- "/lib", "/lib32", "/lib64", "/bin", "/sbin", "/usr", "/etc", "/app", "/dev", "/proc", NULL
+ "/usr", "/etc", "/app", "/dev", "/proc", NULL
};
static char *
@@ -547,6 +549,16 @@ _exports_path_expose (FlatpakExports *exports,
}
}
+ for (i = 0; flatpak_abs_usrmerged_dirs[i] != NULL; i++)
+ {
+ /* Same as /usr, but for the directories that get merged into /usr */
+ if (flatpak_has_path_prefix (path, flatpak_abs_usrmerged_dirs[i]))
+ {
+ g_debug ("skipping export for path %s", path);
+ return FALSE;
+ }
+ }
+
/* Handle any symlinks prior to the target itself. This includes path itself,
because we expose the target of the symlink. */
slash = canonical;