[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Portability issue with `putenv'
From: |
James Youngman |
Subject: |
Re: Portability issue with `putenv' |
Date: |
Tue, 22 Feb 2005 10:36:42 +0000 |
User-agent: |
Mutt/1.3.28i |
On Tue, Feb 22, 2005 at 08:24:07AM +0100, Tim Van Holder wrote:
> 3) I'm not 100% sure, but I _think_ it is allowed to
> modify the string you passed to putenv later, and that
> such changes will have effect on future getenv() calls;
> that behaviour is broken by your version of putenv().
You're right, I hadn't thought of that. According to the POSIX
standard (IEEE Std 1003.1, 2003 Edition),
| The 'string' argument should point to a string of the form " name=
| value ". The putenv() function shall make the value of the
| environment variable 'name' equal to 'value' by altering an
| existing variable or creating a new one. In either case, the
| string pointed to by 'string' shall become part of the
| environment, so altering the string shall change the environment.
James.