[PATCH libgpg-error] Add support for IBM z/OS

Jacob Bachmeyer jcb62281 at gmail.com
Wed Jun 11 04:43:28 CEST 2025


On 6/10/25 10:15, Sachin T via Gnupg-devel wrote:
>
> [...]
>
>     3. On z/OS, environ is defined as a macro in <stdlib.h>, so it is
>     temporarily redefined around the header inclusion to avoid conflicts.
>
> [...]
>
> diff --git a/src/spawn-posix.c b/src/spawn-posix.c
> index ac19761..2666862 100644
> --- a/src/spawn-posix.c
> +++ b/src/spawn-posix.c
> @@ -27,8 +27,17 @@
>
> #error This code is only used on POSIX
> #endif
>
> +#if defined(__MVS__)
> +#define environ environ_replace
> +#endif
> +
> #include <stdio.h>
> #include <stdlib.h>
> +
> +#if defined(__MVS__)
> +#undef environ
> +#endif
> +
> #include <stdint.h>
> #include <string.h>
> #include <errno.h>
>
What exactly is this dance supposed to do?  The C preprocessor has no 
equivalent to M4's pushdef()/popdef().

If environ is supposed to be a symbol, then there is no reason to define 
it before including stdlib.h and undefining it to get rid of the macro.  
If the file does not use environ, then why care? If environ's macro 
definition is actually important on z/OS, then this dance likely causes 
breakage.

What is this trying to accomplish?


-- Jacob
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.gnupg.org/pipermail/gnupg-devel/attachments/20250610/ff48ed99/attachment.html>


More information about the Gnupg-devel mailing list