On Sun, Jul 30, 2017 at 21:39:47 +0100, Richard Ipsum wrote:
On Sun, Jul 30, 2017 at 03:01:20PM -0400, Daniel Silverstone wrote:
> On Sun, Jul 30, 2017 at 19:31:17 +0100, Richard Ipsum wrote:
> > + extern char **environ;
>
> Should this not be #include'd from unistd.h ?
I think that's one way to do it, but I don't know that it's as portable.
My man page says it's only defined in unistd.h if _GNU_SOURCE is defined.
Where as, as far as I can tell, the global variable `environ` is defined
by POSIX.
Interesting...
/* NULL-terminated array of "NAME=VALUE" environment variables. */
extern char **__environ;
#ifdef __USE_GNU
extern char **environ;
#endif
I wonder if that's purely glibc or something else too.
*rummages for musl source*
That also guards it, with _GNU_SOURCE
Interesting.
I wonder if there's something we could do, perhaps by means of execve to pass
an empty/sanitised environment in... I'm not comfortable with the extern
char** esp. since unistd.h on FreeBSD seems to lack it entirely, and while
supple has Linux specific bits, I'd like it to be portable if at all possible.
Perhaps we might capture the incoming environment by dint of the 3 argument
main function? Then we could explicitly unset everything from there. I shall
have a quick hack and see what I think...
Ah, and now my new signature is coincidentally ironic... how like
life >.>
--
Life is too short for POSIX compliance
Sweet irony :-)
D.
--
Daniel Silverstone
http://www.digital-scurf.org/
PGP mail accepted and encouraged. Key Id: 3CCE BABE 206C 3B69