Also use explicit_memset (NetBSD) with cmake, scons and meson

This commit is contained in:
Stefan Bühler 2019-08-22 13:13:24 +02:00
parent 79760d935a
commit d7c0fc295f
4 changed files with 4 additions and 1 deletions

View File

@ -388,6 +388,7 @@ if 1:
'dup2',
'epoll_ctl',
'explicit_bzero',
'explicit_memset',
'fork',
'getcwd',
'gethostbyname',

View File

@ -185,6 +185,7 @@ check_function_exists(issetugid HAVE_ISSETUGID)
check_function_exists(inet_pton HAVE_INET_PTON)
check_function_exists(memset_s HAVE_MEMSET_S)
check_function_exists(explicit_bzero HAVE_EXPLICIT_BZERO)
check_function_exists(explicit_memset HAVE_EXPLICIT_MEMSET)
check_symbol_exists(clock_gettime "time.h" HAVE_CLOCK_GETTIME)
if (NOT HAVE_CLOCK_GETTIME)
check_library_exists(rt clock_gettime "time.h" HAVE_CLOCK_GETTIME)

View File

@ -151,6 +151,7 @@ conf_data.set('HAVE_ISSETUGID', compiler.has_function('issetugid', args: defs))
conf_data.set('HAVE_INET_PTON', compiler.has_function('inet_pton', args: defs))
conf_data.set('HAVE_MEMSET_S', compiler.has_function('memset_s', args: defs))
conf_data.set('HAVE_EXPLICIT_BZERO', compiler.has_function('explicit_bzero', args: defs))
conf_data.set('HAVE_EXPLICIT_MEMSET', compiler.has_function('explicit_memset', args: defs))
conf_data.set('HAVE_CLOCK_GETTIME', compiler.has_header_symbol('time.h', 'clock_gettime'))
clock_lib = []

View File

@ -42,7 +42,7 @@ void safe_memclear(void *s, size_t n) {
#elif defined(HAVE_EXPLICIT_BZERO)
explicit_bzero(s, n);
#elif defined(HAVE_EXPLICIT_MEMSET)
explicit_memset(s, 0, n);
explicit_memset(s, 0, n);
#else
safe_memset(s, 0, n);
#endif