Re: getenv, putenv
- From: Måns Rullgård <mans@xxxxxxxxx>
- Date: Wed, 30 Jan 2008 19:56:36 +0000
Rainer Weikusat <rweikusat@xxxxxxxxxxx> writes:
floyd@xxxxxxxxxx (Floyd L. Davidson) writes:
Bhawna <bvnbhati@xxxxxxxxx> wrote:
Hi,
I am running a multithreaded application in which I am trying to set
an environment variable using putenv. The string I am using as
argument to putenv was created as
char *str=strdup(<local var>);
1) Don't use an auto variable.
This doesn't matter. The string needs to be alive for as it is still
part of the environment, not some random pointer to it.
2) The symbol "str" violates the implemenation's
name space if you have also included <strings.h>.
You mean string.h.
I don't think so. SUS only reserves any identifier beginning with str,
followed by a lower case letter.
Correct, and the reservation only applies to identifiers with file
scope, so an identifier with block scope can safely be called 'str'.
--
Måns Rullgård
mans@xxxxxxxxx
.
- References:
- getenv, putenv
- From: Bhawna
- Re: getenv, putenv
- From: Floyd L. Davidson
- Re: getenv, putenv
- From: Rainer Weikusat
- getenv, putenv
- Prev by Date: Re: getenv, putenv
- Next by Date: Re: getenv, putenv
- Previous by thread: Re: getenv, putenv
- Next by thread: Re: getenv, putenv
- Index(es):
Relevant Pages
|