From 848189f10a98768b372186de8b9fe013ad49d4e5 Mon Sep 17 00:00:00 2001 From: Omar Polo Date: Thu, 6 Jun 2024 13:43:12 +0000 Subject: attempt to deal with the portability fiasco of strnvis(3) --- utils.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'utils.c') diff --git a/utils.c b/utils.c index 7ceea2e..bbb6b11 100644 --- a/utils.c +++ b/utils.c @@ -22,6 +22,7 @@ #include #include +#include /* for gmid_strnvis() */ #include #include @@ -496,3 +497,19 @@ new_proxy(void) p->protocols = TLS_PROTOCOLS_DEFAULT; return p; } + +/* + * I can't rant enough about this situation. As far as I've understood, + * OpenBSD introduced strnvis(3) with a signature, then NetBSD did it but + * with a incompatible signature. FreeBSD followed NetBSD. libbsd followed + * OpenBSD but now is thinking to switch. WTF? + */ +int +gmid_strnvis(char *dst, const char *src, size_t destsize, int flag) +{ +#if HAVE_BROKEN_STRNVIS + return strnvis(dst, destsize, src, flag); +#else + return strnvis(dst, src, destsize, flag); +#endif +} -- cgit v1.2.3