From ac15e2319c20c8d3fe7d04f8a6242b04f6a42820 Mon Sep 17 00:00:00 2001
From: Marcus Comstedt <marcus@mc.pp.se>
Date: Mon, 4 Jan 2021 12:39:44 +0100
Subject: [PATCH] I/O [macOS]: Include <util.h> for openpty

---
 src/configure.in            | 2 +-
 src/fdlib.h                 | 3 +++
 src/modules/HTTPLoop/util.h | 1 +
 3 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/configure.in b/src/configure.in
index 70b4203dfe..995c87b678 100644
--- a/src/configure.in
+++ b/src/configure.in
@@ -3275,7 +3275,7 @@ AC_CHECK_HEADERS(winsock2.h sys/rusage.h time.h sys/time.h sys/types.h \
 		 mach/mach_init.h syscall.h sys/syscall.h devices/timer.h \
 		 direct.h CoreServices/CoreServices.h execinfo.h \
 		 mach/mach.h mach/thread_act.h mach/clock.h urcu.h \
-		 machine/bswap.h sys/endian.h,,,[
+		 machine/bswap.h sys/endian.h util.h,,,[
 #if (defined(__WINNT__) || defined(__WIN32__)) && !defined(__NT__)
 #define __NT__
 #endif
diff --git a/src/fdlib.h b/src/fdlib.h
index 5915219b8e..68906cc48f 100644
--- a/src/fdlib.h
+++ b/src/fdlib.h
@@ -623,6 +623,9 @@ typedef struct my_fd_set_s my_fd_set;
 #define TTY_CAPABILITIES (fd_TTY | fd_INTERPROCESSABLE | fd_BIDIRECTIONAL | fd_CAN_NONBLOCK)
 
 #ifdef HAVE_OPENPTY
+#ifdef HAVE_UTIL_H
+#include <util.h>
+#endif
 #define fd_openpty	openpty	/* FIXME */
 #endif
 
diff --git a/src/modules/HTTPLoop/util.h b/src/modules/HTTPLoop/util.h
index fe7cac9278..5fe4c0e378 100644
--- a/src/modules/HTTPLoop/util.h
+++ b/src/modules/HTTPLoop/util.h
@@ -12,4 +12,5 @@ ptrdiff_t aap_swrite(int to, char *buf, size_t towrite);
 #define H_STRING 2
 
 
+struct args;
 int aap_get_header(struct args *req, char *header, int operation, void *res);
-- 
GitLab