From 1ca2daf47f72d3a3ce8e99bf60da4dc166e4b501 Mon Sep 17 00:00:00 2001 From: ashuntu <101582426+ashuntu@users.noreply.github.com> Date: Wed, 31 Aug 2022 09:12:12 -0500 Subject: [PATCH] Make more readable --- lib/client_impl.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/lib/client_impl.c b/lib/client_impl.c index d9abab5..c3e1234 100644 --- a/lib/client_impl.c +++ b/lib/client_impl.c @@ -109,8 +109,8 @@ static inline int *alloc_fd_array(int n) return fds; } -// Helper to check if we are running inside a containerized framework like Flatpak or Snap -static int in_containerized(void) +// Helper to check if we are running inside a sandboxed framework like Flatpak or Snap +static int in_sandbox(void) { static int status = -1; @@ -119,7 +119,11 @@ static int in_containerized(void) int r; r = lstat("/.flatpak-info", &sb); - status = (r == 0 && sb.st_size > 0) || getenv("SNAP"); + status = r == 0 && sb.st_size > 0; + + if (getenv("SNAP")) { + status = 1; + } } return status; @@ -302,7 +306,8 @@ static int gamemode_request(const char *method, pid_t for_pid) int native; int res = -1; - native = !in_containerized(); + + native = !in_sandbox(); /* pid[0] is the client, i.e. the game * pid[1] is the requestor, i.e. this process