> It turns out that I am sending a "const" string to putenv which is
> defined:
> 
> ./stdlib.h:extern int putenv (char *__string) __THROW;
<snip>
> Should I raise this as a bug?

It isn't actually a bug.  putenv puts the supplied string into the
environment (not a copy, the supplied string).  This means a future call
to getenv will return a pointer to it, (a char *), which can be modified
to change the value.  Thus to be correct putenv can't take a const, as
it can't guarentee how the pointer will be used in future.

Take a look at the man page for putenv, in particular the notes.  As you
can see from the description, the function has a rather interesting
history in glibc ;-)

        Regards,
        nash
        [Too much C for my own good]
-- 
Brett Nash <[EMAIL PROTECTED]>
Sometimes it's better to light a flamethrower than curse the darkness.
-- 
SLUG - Sydney Linux User's Group - http://slug.org.au/
More Info: http://lists.slug.org.au/listinfo/slug

Reply via email to