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

Jacob Bachmeyer via Gnupg-devel <[email protected]>
Newsgroups gmane.comp.encryption.gpg.devel
Message-ID <[email protected]>
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

_______________________________________________
Gnupg-devel mailing list
[email protected]
https://lists.gnupg.org/mailman/listinfo/gnupg-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.