Browse Source

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

personal/stbuehler/ci-build
Stefan Bühler 2 years ago
parent
commit
d7c0fc295f
  1. 1
      SConstruct
  2. 1
      src/CMakeLists.txt
  3. 1
      src/meson.build
  4. 2
      src/safe_memclear.c

1
SConstruct

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

1
src/CMakeLists.txt

@ -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)

1
src/meson.build

@ -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 = []

2
src/safe_memclear.c

@ -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

Loading…
Cancel
Save