Hello, libXau has status "Unmaintained"
I'd like to apply two patches: 1) Test for __GNUC__ as well as __clang__ since gcc has no attributes for __attribute((malloc)) as well; 2) Add a feature test to explicit_memset(3) supplementary to explicit_bzero(3), since bzero(3) is deprecated (even removed from current POSIX), and explicit_memset(3) is proposed for standard and supported at least on BSDs. How to propose the patches? FYI, the two sets are attached. -- Thierry Laronde <tlaronde +AT+ kergis +dot+ com> http://www.kergis.com/ http://kertex.kergis.com/ Key fingerprint = 0FF7 E906 FBAF FE95 FD89 250D 52B1 AE95 6006 F40C
diff --git a/include/X11/Xauth.h b/include/X11/Xauth.h index 51e913f..f6c0c6e 100644 --- a/include/X11/Xauth.h +++ b/include/X11/Xauth.h @@ -78,8 +78,8 @@ _XFUNCPROTOBEGIN #endif #if __has_attribute(malloc) -# if defined(__clang__) -/* Clang does not support the optional deallocator argument */ +# if defined(__clang__) || defined(__GNUC__) +/* Clang or gcc do not support the optional deallocator argument */ # define XAU_MALLOC_ATTRIBUTE(X) __attribute__((malloc)) # else # define XAU_MALLOC_ATTRIBUTE(X) __attribute__((malloc X))
diff --git a/AuDispose.c b/AuDispose.c index 791232a..a449390 100644 --- a/AuDispose.c +++ b/AuDispose.c @@ -40,6 +40,8 @@ XauDisposeAuth (Xauth *auth) if (auth->data) { #ifdef HAVE_EXPLICIT_BZERO (void) explicit_bzero (auth->data, auth->data_length); +#elif HAVE_EXPLICIT_MEMSET + (void) explicit_memset (auth->data, 0, auth->data_length); #else (void) bzero (auth->data, auth->data_length); #endif diff --git a/AuRead.c b/AuRead.c index 93774b0..649a1d8 100644 --- a/AuRead.c +++ b/AuRead.c @@ -58,6 +58,8 @@ read_counted_string (unsigned short *countp, char **stringp, FILE *file) if (fread (data, sizeof (char), len, file) != len) { #ifdef HAVE_EXPLICIT_BZERO explicit_bzero (data, len); +#elif HAVE_EXPLICIT_MEMSET + explicit_memset (data, 0, len); #else bzero (data, len); #endif @@ -107,6 +109,8 @@ XauReadAuth (FILE *auth_file) if (local.data) { #ifdef HAVE_EXPLICIT_BZERO explicit_bzero (local.data, local.data_length); +#elif HAVE_EXPLICIT_MEMSET + explicit_memset (local.data, 0, local.data_length); #else bzero (local.data, local.data_length); #endif diff --git a/configure.ac b/configure.ac index 240610c..f062dbb 100644 --- a/configure.ac +++ b/configure.ac @@ -45,7 +45,7 @@ XORG_DEFAULT_OPTIONS AC_PROG_LN_S # Checks for library functions. -AC_CHECK_FUNCS([explicit_bzero pathconf]) +AC_CHECK_FUNCS([explicit_bzero explicit_memset pathconf]) # Obtain compiler/linker options for dependencies PKG_CHECK_MODULES(XAU, xproto) diff --git a/meson.build b/meson.build index 6ca975a..a3dec49 100644 --- a/meson.build +++ b/meson.build @@ -19,7 +19,7 @@ cc = meson.get_compiler('c') lib_args = [] -foreach f : ['explicit_bzero', 'pathconf'] +foreach f : ['explicit_bzero', 'explicit_memset', 'pathconf'] if cc.has_function(f) lib_args += '-DHAVE_@0@'.format(f.to_upper()) endif @@ -93,4 +93,4 @@ pkg.generate( requires : 'xproto', ) -subdir('man') \ No newline at end of file +subdir('man')