Skip to content

Commit

Permalink
glnx-backports: Include <glib-unix.h>
Browse files Browse the repository at this point in the history
When compiling with GLib older than 2.80.x, we provide a compatibility
backport of g_closefrom() and g_fdwalk_set_cloexec(), but when compiling
with newer GLib, we rely on GLib to provide those.

The intended scope of libglnx (Linux only) is narrower than the scope
of `<glib-unix.h>` (any Unix platform), so we can safely include
`<glib-unix.h>` unconditionally. This provides least-astonishment by
having `#include <libglnx.h>` with newer GLib always provide a superset
of the functionality it provides with older GLib.

This would have avoided needing
flatpak/flatpak#5737.

Fixes: 6ada39c "backports: Add a backport of g_closefrom(), g_fdwalk_set_cloexec()"
Signed-off-by: Simon McVittie <[email protected]>
  • Loading branch information
smcv committed May 13, 2024
1 parent b38235a commit 8ed45a1
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions glnx-backports.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

#include <string.h>

#include <glib-unix.h>
#include <gio/gio.h>

G_BEGIN_DECLS
Expand Down

0 comments on commit 8ed45a1

Please sign in to comment.