summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDarren Tucker <dtucker@dtucker.net>2018-02-24 20:25:22 +1100
committerDarren Tucker <dtucker@dtucker.net>2018-02-26 00:09:04 +1100
commita9004425a032d7a7141a5437cfabfd02431e2a74 (patch)
treeb1f1f7914c2d65457ff313427049343153db6ef4
parent1a348359e4d2876203b5255941bae348557f4f54 (diff)
Check for bzero and supply if needed.
Since explicit_bzero uses it via an indirect it needs to be a function not just a macro.
-rw-r--r--configure.ac3
-rw-r--r--openbsd-compat/bsd-misc.c8
-rw-r--r--openbsd-compat/bsd-misc.h4
3 files changed, 15 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index e81e3eccd..e23540e63 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1695,6 +1695,7 @@ AC_CHECK_FUNCS([ \
1695 bcrypt_pbkdf \ 1695 bcrypt_pbkdf \
1696 bindresvport_sa \ 1696 bindresvport_sa \
1697 blf_enc \ 1697 blf_enc \
1698 bzero \
1698 cap_rights_limit \ 1699 cap_rights_limit \
1699 clock \ 1700 clock \
1700 closefrom \ 1701 closefrom \
@@ -1800,6 +1801,8 @@ AC_CHECK_FUNCS([ \
1800 warn \ 1801 warn \
1801]) 1802])
1802 1803
1804AC_CHECK_DECLS([bzero])
1805
1803dnl Wide character support. 1806dnl Wide character support.
1804AC_CHECK_FUNCS([mblen mbtowc nl_langinfo wcwidth]) 1807AC_CHECK_FUNCS([mblen mbtowc nl_langinfo wcwidth])
1805 1808
diff --git a/openbsd-compat/bsd-misc.c b/openbsd-compat/bsd-misc.c
index 9f6dc8af2..3e8f74b72 100644
--- a/openbsd-compat/bsd-misc.c
+++ b/openbsd-compat/bsd-misc.c
@@ -282,3 +282,11 @@ llabs(long long j)
282 return (j < 0 ? -j : j); 282 return (j < 0 ? -j : j);
283} 283}
284#endif 284#endif
285
286#ifndef HAVE_BZERO
287void
288bzero(void *b, size_t n)
289{
290 (void)memset(b, 0, n);
291}
292#endif
diff --git a/openbsd-compat/bsd-misc.h b/openbsd-compat/bsd-misc.h
index 2cfd5dae6..bf5fad188 100644
--- a/openbsd-compat/bsd-misc.h
+++ b/openbsd-compat/bsd-misc.h
@@ -133,4 +133,8 @@ void warn(const char *, ...) __attribute__((format(printf, 1, 2)));
133long long llabs(long long); 133long long llabs(long long);
134#endif 134#endif
135 135
136#ifndef HAVE_DECL_BZERO
137void bzero(void *, size_t);
138#endif
139
136#endif /* _BSD_MISC_H */ 140#endif /* _BSD_MISC_H */