Skip to content

Commit

Permalink
pextlib1.0: Sort includes, declare getline(3)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
neverpanic committed Oct 14, 2024
1 parent af49e24 commit 92289a9
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions src/pextlib1.0/system.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 <tcl.h>
Expand All @@ -46,18 +46,19 @@
#include <paths.h>
#endif

#include <sys/types.h>
#include <sys/wait.h>
#include <sys/resource.h>
#include <assert.h>
#include <errno.h>
#include <fcntl.h>
#include <limits.h>
#include <signal.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/resource.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>
#include <limits.h>
#include <errno.h>
#include <signal.h>

#include "system.h"
#include "Pextlib.h"
Expand Down

0 comments on commit 92289a9

Please sign in to comment.