From 92289a901dcf78aeda21e08d371bd26957cd66e5 Mon Sep 17 00:00:00 2001 From: Clemens Lang Date: Mon, 14 Oct 2024 21:46:49 +0200 Subject: [PATCH] pextlib1.0: Sort includes, declare getline(3) Linux requires stdio.h for getline(3), and fails without it. glibc >= 2.10 defines getline(3) in _XOPEN_SOURCE >= 700. We ship a getline.h compat implementation, but that doesn't get included unless HAVE_GETLINE isn't defined, which isn't the case on Linux. --- src/pextlib1.0/system.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/pextlib1.0/system.c b/src/pextlib1.0/system.c index d9ea2f4bef..b6cf8f1e14 100644 --- a/src/pextlib1.0/system.c +++ b/src/pextlib1.0/system.c @@ -36,8 +36,8 @@ #endif #ifndef __APPLE__ -/* required for fdopen(3)/seteuid(2), among others */ -#define _XOPEN_SOURCE 600 +/* required for fdopen(3)/seteuid(2)/getline(3), among others */ +#define _XOPEN_SOURCE 700 #endif #include @@ -46,18 +46,19 @@ #include #endif -#include -#include -#include #include +#include #include +#include +#include #include +#include #include #include +#include +#include +#include #include -#include -#include -#include #include "system.h" #include "Pextlib.h"