[Gllug] endian.h

Tethys tet at accucard.com
Fri Feb 7 17:42:05 UTC 2003


rich at annexia.org writes:

>Actually putenv is an example of a really evil API, an invitation
>for memory corruption bugs, because it's very hard to tell the lifetime
>of the string that you pass as a parameter (in real, large programs
>anyway).

Huh? How so? The string effectively lives forever, as it directly
becomes parts of the environment. Indeed, that rationale for it's
behaviour in SUSv3 says:

	The standard developers noted that putenv() is the only function
	available to add to the environment without permitting memory leaks.

My only beef with putenv() is that it isn't reentrant, and there isn't
a putenv_r().

BTW, as it turns out, my earlier claim that setenv() was a BSDism not
supported elsewhere is wrong. It's now part of the SUS, and is listed
as the preferred interface, over putenv()[1]. I'm not therefore sure
what excuse Sun have for failing to implement it in Solaris.

Tet

[1] Either this wasn't the case in earlier versions of SUS, or my
    memory's failing me... again.

-- 
Gllug mailing list  -  Gllug at linux.co.uk
http://list.ftech.net/mailman/listinfo/gllug




More information about the GLLUG mailing list