[Libguestfs] [PATCH nbdkit] freebsd, openbsd: Add an extern decl for environ.

Eric Blake eblake at redhat.com
Tue Apr 28 16:03:51 UTC 2020


On 4/28/20 10:43 AM, Richard W.M. Jones wrote:
> ---
>   configure.ac      | 24 ++++++++++++++++++++++++
>   plugins/sh/call.c |  4 ++++
>   2 files changed, 28 insertions(+)
> 
> diff --git a/configure.ac b/configure.ac
> index cdddae73..9b925539 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -266,6 +266,30 @@ test (int a)
>       ]
>   )
>   
> +dnl 'environ' is not always declared in public header files:
> +dnl Linux => <unistd.h>  Haiku => <stdlib.h>
> +dnl FreeBSD & OpenBSD => not declared

POSIX says that a user must declare 'environ' themselves (the only POSIX 
public entry point with that odd requirement); any system that provides 
it via a header is merely being nice, and should only do so when 
extensions are requested (but we always request extensions).

We could either do this conditionally (as you have done here) or blindly 
(but then risk collisions if our declaration doesn't quite match the 
systems that DO provide it via public headers as an extension), so I 
like your approach.

ACK.

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org




More information about the Libguestfs mailing list