Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

utils: Refactoring #5416

Merged
merged 8 commits into from
Jul 3, 2023
Prev Previous commit
Next Next commit
common: Move flatpak_abs_usrmerged_dirs to FlatpakExports
This will help to break circular dependencies between FlatpakExports
and flatpak-run.

Signed-off-by: Simon McVittie <[email protected]>
  • Loading branch information
smcv authored and alexlarsson committed Jul 3, 2023
commit 649902a577bc71182813e9236c232b76587f02b5
2 changes: 2 additions & 0 deletions common/flatpak-exports-private.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,6 @@ void flatpak_exports_take_host_fd (FlatpakExports *exports,
void flatpak_exports_set_test_flags (FlatpakExports *exports,
FlatpakExportsTestFlags flags);

extern const char * const *flatpak_abs_usrmerged_dirs;

#endif /* __FLATPAK_EXPORTS_H__ */
11 changes: 11 additions & 0 deletions common/flatpak-exports.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,17 @@
#include "flatpak-systemd-dbus-generated.h"
#include "flatpak-error.h"

static const char * const abs_usrmerged_dirs[] =
{
"/bin",
"/lib",
"/lib32",
"/lib64",
"/sbin",
NULL
};
const char * const *flatpak_abs_usrmerged_dirs = abs_usrmerged_dirs;

/* 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.
flatpak_abs_usrmerged_dirs get the same treatment without having to be listed
Expand Down
2 changes: 0 additions & 2 deletions common/flatpak-run-private.h
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,4 @@ gboolean flatpak_run_app (FlatpakDecomposed *app_ref,
GCancellable *cancellable,
GError **error);

extern const char * const *flatpak_abs_usrmerged_dirs;

#endif /* __FLATPAK_RUN_H__ */
11 changes: 0 additions & 11 deletions common/flatpak-run.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,17 +66,6 @@

#define DEFAULT_SHELL "/bin/sh"

const char * const abs_usrmerged_dirs[] =
{
"/bin",
"/lib",
"/lib32",
"/lib64",
"/sbin",
NULL
};
const char * const *flatpak_abs_usrmerged_dirs = abs_usrmerged_dirs;

static int
flatpak_extension_compare_by_path (gconstpointer _a,
gconstpointer _b)
Expand Down