PATCH: Tweak 22_locale to hide more "expected errors"

Ulrich Drepper drepper@redhat.com
Tue Mar 11 05:54:00 GMT 2003


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Loren James Rittle wrote:

> Now, a basic improvement might be to support putenv() when it is
> available and setenv() was not available (Kaveh wrote that putenv() is
> more portable;

Using putenv() is almost always wrong.  Read the specs of the function.
 The string passes as the argument is added to the environment.  Not a
copy, the string itself.  If the string is allocated on the stack the
frame mustn't be left.  If it's dynamically allocated the memory might
leak when the entry gets replaced.

Use setenv() and ignore this bad advise.

- -- 
- --------------.                        ,-.            444 Castro Street
Ulrich Drepper \    ,-----------------'   \ Mountain View, CA 94041 USA
Red Hat         `--' drepper at redhat.com `---------------------------
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQE+bXot2ijCOnn/RHQRAhwVAJ9bDduNbJFrV6vb4vzaMpHSGNotdwCguuFH
MMZGUZevJuH8Rfvb4wRTe4g=
=tiWU
-----END PGP SIGNATURE-----



More information about the Libstdc++ mailing list