Provide fallback code for non-portable clearenv(3)
authorJérémie Courrèges-Anglas <jca@wxcvbn.org>
Wed, 27 Apr 2016 16:01:51 +0000 (18:01 +0200)
committerJeremy Allison <jra@samba.org>
Thu, 28 Apr 2016 22:12:02 +0000 (00:12 +0200)
commitf198abcbb3f6e8b26c697d3ded2caa1076ae018b
tree7aca2b7209ed8d1542951e56d36668aeadddc2b9
parent90403de7acdfec2aa3c752f6add27bc6f0e9ac30
Provide fallback code for non-portable clearenv(3)

clearenv(3) is a GNU extension that was rejected twice by POSIX,
without an easy, portable alternative.

As the dovecot project notes,
"""
environ = NULL crashes on OSX - and OpenBSD < 6.0
*environ = NULL doesn't work on FreeBSD 7.0
environ = emptyenv doesn't work on Haiku OS
environ = calloc should work everywhere
"""
(source: http://hg.dovecot.org/dovecot-2.0/file/48f90e7e92dc/src/lib/env-util.c)

Bug: https://bugzilla.samba.org/show_bug.cgi?id=11864
Signed-off-by: Jérémie Courrèges-Anglas <jca@wxcvbn.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Fri Apr 29 00:12:02 CEST 2016 on sn-devel-144
source3/client/smbspool_krb5_wrapper.c
source3/wscript