setenv in assuan-pipe-connect.c

Marcus Brinkmann marcus.brinkmann at
Mon Sep 12 15:48:54 CEST 2005

At Wed, 31 Aug 2005 15:59:31 -0500,
Martin Traviolia <martin.traviolia at> wrote:
> I am building libassuan-0.6.10 on Solaris 9 using Sun's 5.6 C compiler.
> In the file "assuan-pipe-connect.c" is a call to "setenv" which is not
> available on Solaris 9.


> Looking at the Single UNXI Specification Version 2 the portable, but
> non-reentrant, call is "putenv".  Otherwise, one would need to copy from
> "extern char** environ;" and use "execve".

Actually, current POSIX and Single UNIX specifications (version 3)
recommend the use of setenv over putenv:

"The setenv() function is preferred over this function."

Unfortunately, neither putenv nor setenv is guaranteed to be thread-safe!

But then, using fork in a threaded context is always a bit of a gamble.

> Since Solaris is not a supported platform this may not be worth changing.
> I think I can safely comment it out as I just need gpg-agent.

Can you please try the attached patch?  It is unfortunately rather
big, because I changed the gnulib setup completely to make it
automatic (the setenv replacement function has so many dependencies
that this seems simpler to me).

Please let me know if this patch works for you.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: assuan-gnulib.patch.gz
Type: application/octet-stream
Size: 22783 bytes
Desc: not available
Url : /pipermail/attachments/20050912/c9489505/assuan-gnulib.patch-0001.obj
-------------- next part --------------

More information about the Gnupg-devel mailing list