-
Simon McVittie authored
This ensures that we include it in every translation unit. Rename it to _pressure-vessel-config.h to avoid accidentally including the wrong config.h in the presence of submodules. Signed-off-by:
Simon McVittie <smcv@collabora.com>
Simon McVittie authoredThis ensures that we include it in every translation unit. Rename it to _pressure-vessel-config.h to avoid accidentally including the wrong config.h in the presence of submodules. Signed-off-by:
Simon McVittie <smcv@collabora.com>
glib-backports.c 6.63 KiB
/*
* Backports from GLib
*
* Copyright 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
* Copyright 1997-2000 GLib team
* Copyright 2000 Red Hat, Inc.
* Copyright 2019 Collabora Ltd.
* g_execvpe implementation based on GNU libc execvp:
* Copyright 1991, 92, 95, 96, 97, 98, 99 Free Software Foundation, Inc.
*
* This library 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/>.
*/
#include "glib-backports.h"
#include <errno.h>
#include <string.h>
#include <sys/wait.h>
#include <unistd.h>
/* We have no internationalization */
#define _(x) x
#if !GLIB_CHECK_VERSION (2, 34, 0)
G_DEFINE_QUARK (g-spawn-exit-error-quark, my_g_spawn_exit_error)
#endif
#if !GLIB_CHECK_VERSION (2, 36, 0)
/**
* g_close:
* @fd: A file descriptor
* @error: a #GError
*
* This wraps the close() call; in case of error, %errno will be
* preserved, but the error will also be stored as a #GError in @error.
*
* Besides using #GError, there is another major reason to prefer this
* function over the call provided by the system; on Unix, it will
* attempt to correctly handle %EINTR, which has platform-specific
* semantics.
*
* Returns: %TRUE on success, %FALSE if there was an error.
*
* Since: 2.36
*/
gboolean
my_g_close (gint fd,
GError **error)
{
int res;
res = close (fd);
/* Just ignore EINTR for now; a retry loop is the wrong thing to do
* on Linux at least. Anyone who wants to add a conditional check
* for e.g. HP-UX is welcome to do so later...
*
* http://lkml.indiana.edu/hypermail/linux/kernel/0509.1/0877.html
* https://bugzilla.gnome.org/show_bug.cgi?id=682819
* http://utcc.utoronto.ca/~cks/space/blog/unix/CloseEINTR
* https://sites.google.com/site/michaelsafyan/software-engineering/checkforeintrwheninvokingclosethinkagain