Hi!

On Tue, 2021-10-05 at 20:49:53 +0200, Svante Signell wrote:
> Index: p11-kit-0.24.0-2.3/common/unix-peer.c
> ===================================================================
> --- p11-kit-0.24.0-2.3.orig/common/unix-peer.c
> +++ p11-kit-0.24.0-2.3/common/unix-peer.c
> @@ -36,7 +36,6 @@
>  
>  #include "unix-peer.h"
>  
> -#include <unistd.h>
>  #include <sys/types.h>
>  #include <sys/socket.h>
>  #include <sys/un.h>
> @@ -47,6 +46,13 @@
>  #  include <ucred.h>
>  #endif
>  
> +#ifdef HAVE_GETPEEREID
> +/* Declare getpeereid() */
> +#include <bsd/unistd.h>
> +#else
> +#include <unistd.h>
> +#endif
> +
>  /* Returns the unix domain socket peer information.
>   * Returns zero on success.
>   */

This should not be needed if the patch were to use the
libbsd-overlay, which should make it transparent.

> @@ -73,7 +79,8 @@ p11_get_upeer_id (int cfd, uid_t *uid, u
>               *pid = cr.pid;
>  
>  #elif defined(HAVE_GETPEEREID)
> -     /* *BSD/MacOSX */
> +     /* *BSD/MacOSX/kFreeBSD/Hurd */
> +
>       uid_t euid;
>       gid_t egid;
>  

> Index: p11-kit-0.24.0-2.3/configure.ac
> ===================================================================
> --- p11-kit-0.24.0-2.3.orig/configure.ac
> +++ p11-kit-0.24.0-2.3/configure.ac
> @@ -132,6 +132,16 @@ if test "$os_unix" = "yes"; then
>       AC_CHECK_FUNCS([getpeereid])
>       AC_CHECK_FUNCS([getpeerucred])
>       AC_CHECK_FUNCS([issetugid])
> +     case "$host_os" in
> +     kfreebsd*-gnu | gnu*)
> +             have_getpeereid=no
> +             AC_CHECK_LIB(bsd, getpeereid, have_getpeereid=yes)
> +             if test "x$have_getpeereid" = "xyes"; then
> +                     AC_DEFINE([HAVE_GETPEEREID], [1], [have getpeereid])
> +                     AC_SEARCH_LIBS([getpeereid], [bsd])
> +             fi
> +     ;;
> +     esac

This would ideally use the PKG_CHECK_MODULES instead and set the CFLAGS
and LIBS variables appropriately before the other checks so that they
can find the functions provided by libbsd.

>       AC_CACHE_CHECK([for thread-local storage class],
>               [ac_cv_tls_keyword],

Thanks,
Guillem

Reply via email to