aboutsummaryrefslogtreecommitdiff
path: root/utils.c
diff options
context:
space:
mode:
authorOmar Polo <op@omarpolo.com>2024-06-06 13:43:12 +0000
committerOmar Polo <op@omarpolo.com>2024-06-06 13:43:12 +0000
commit848189f10a98768b372186de8b9fe013ad49d4e5 (patch)
treee2d451bf4bbc6ac51e0ea98f1ad9cd409f408aa8 /utils.c
parent1bc73c3bcbd85e2682afca36595ea44a75345e65 (diff)
attempt to deal with the portability fiasco of strnvis(3)
Diffstat (limited to 'utils.c')
-rw-r--r--utils.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/utils.c b/utils.c
index 7ceea2e..bbb6b11 100644
--- a/utils.c
+++ b/utils.c
@@ -22,6 +22,7 @@
#include <errno.h>
#include <string.h>
+#include <vis.h> /* for gmid_strnvis() */
#include <openssl/ec.h>
#include <openssl/err.h>
@@ -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
+}