-
Simon McVittie authored
A lot of the code added here is #if 0. Normally we don't commit commented-out or #ifdef'd out code, but in this case it helps tools like gvimdiff to have enough context to figure out which parts of the file in Flatpak correspond to which parts of the file in pressure-vessel. Signed-off-by:
Simon McVittie <smcv@collabora.com>
Simon McVittie authoredA lot of the code added here is #if 0. Normally we don't commit commented-out or #ifdef'd out code, but in this case it helps tools like gvimdiff to have enough context to figure out which parts of the file in Flatpak correspond to which parts of the file in pressure-vessel. Signed-off-by:
Simon McVittie <smcv@collabora.com>
flatpak-run.c 43.84 KiB
/*
* Cut-down version of common/flatpak-run.c from Flatpak
* Last updated: Flatpak 1.6.1
*
* Copyright © 2017-2019 Collabora Ltd.
* Copyright © 2014-2019 Red Hat, Inc
*
* SPDX-License-Identifier: LGPL-2.1-or-later
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
* Authors:
* Alexander Larsson <alexl@redhat.com>
*/
#include "config.h"
#include "flatpak-run-private.h"
#include <sys/utsname.h>
#include <X11/Xauth.h>
#include <gio/gio.h>
#include "libglnx/libglnx.h"
#include "flatpak-utils-base-private.h"
#include "flatpak-utils-private.h"
/* In Flatpak this is optional, in pressure-vessel not so much */
#define ENABLE_XAUTH
const char * const abs_usrmerged_dirs[] =
{
"/bin",
"/lib",
"/lib32",
"/lib64",
"/sbin",
NULL
};
const char * const *flatpak_abs_usrmerged_dirs = abs_usrmerged_dirs;
static char *
extract_unix_path_from_dbus_address (const char *address)
{
const char *path, *path_end;
if (address == NULL)
return NULL;
if (!g_str_has_prefix (address, "unix:"))
return NULL;
path = strstr (address, "path=");
if (path == NULL)
return NULL;
path += strlen ("path=");
path_end = path;
while (*path_end != 0 && *path_end != ',')