From 3db15d63ae6a9ceeaad80f367e3a7f9df003dae1 Mon Sep 17 00:00:00 2001 From: Jerome Duval Date: Mon, 24 Nov 2014 18:45:00 +0000 Subject: haiku: we define bzero(x, y) but not bzero. diff --git a/openbsd-compat/explicit_bzero.c b/openbsd-compat/explicit_bzero.c index 3c85a48..a02e35e 100644 --- a/openbsd-compat/explicit_bzero.c +++ b/openbsd-compat/explicit_bzero.c @@ -23,6 +23,24 @@ explicit_bzero(void *p, size_t n) #else /* HAVE_MEMSET_S */ +#ifdef __HAIKU__ +/* Haiku defines bzero(x, y) but not bzero */ + +/* + * Indirect memset through a volatile pointer to hopefully avoid + * dead-store optimisation eliminating the call. + */ +static void (* volatile ssh_memset)(void *, int, size_t) = memset; + +void +explicit_bzero(void *p, size_t n) +{ + ssh_memset(p, 0, n); +} + + +#else + /* * Indirect bzero through a volatile pointer to hopefully avoid * dead-store optimisation eliminating the call. @@ -35,6 +53,8 @@ explicit_bzero(void *p, size_t n) ssh_bzero(p, n); } +#endif + #endif /* HAVE_MEMSET_S */ #endif /* HAVE_EXPLICIT_BZERO */ -- 1.8.3.4