<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Setting environment variable with putenv() after call to clearenv() in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/setting-environment-variable-with-putenv-after-call-to-clearenv/m-p/3676028#M102818</link>
    <description>This is simply bad code and it has nothing to do with clearenv(). The problem is that env is only valid the 1st time it is used. You must add this line:&lt;BR /&gt;env = environ;&lt;BR /&gt;before every:&lt;BR /&gt;while (*env) {&lt;BR /&gt;&lt;BR /&gt;or the while loop is never executed because *env is already NULL -- except for the very first while.</description>
    <pubDate>Mon, 21 Nov 2005 15:58:24 GMT</pubDate>
    <dc:creator>A. Clay Stephenson</dc:creator>
    <dc:date>2005-11-21T15:58:24Z</dc:date>
    <item>
      <title>Setting environment variable with putenv() after call to clearenv()</title>
      <link>https://community.hpe.com/t5/operating-system-linux/setting-environment-variable-with-putenv-after-call-to-clearenv/m-p/3676027#M102817</link>
      <description>Call to putenv() failes to set environment variable only after a previous call to clearenv().  See attachment for C source code file.</description>
      <pubDate>Mon, 21 Nov 2005 15:37:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/setting-environment-variable-with-putenv-after-call-to-clearenv/m-p/3676027#M102817</guid>
      <dc:creator>Steve Hosto</dc:creator>
      <dc:date>2005-11-21T15:37:43Z</dc:date>
    </item>
    <item>
      <title>Re: Setting environment variable with putenv() after call to clearenv()</title>
      <link>https://community.hpe.com/t5/operating-system-linux/setting-environment-variable-with-putenv-after-call-to-clearenv/m-p/3676028#M102818</link>
      <description>This is simply bad code and it has nothing to do with clearenv(). The problem is that env is only valid the 1st time it is used. You must add this line:&lt;BR /&gt;env = environ;&lt;BR /&gt;before every:&lt;BR /&gt;while (*env) {&lt;BR /&gt;&lt;BR /&gt;or the while loop is never executed because *env is already NULL -- except for the very first while.</description>
      <pubDate>Mon, 21 Nov 2005 15:58:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/setting-environment-variable-with-putenv-after-call-to-clearenv/m-p/3676028#M102818</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2005-11-21T15:58:24Z</dc:date>
    </item>
    <item>
      <title>Re: Setting environment variable with putenv() after call to clearenv()</title>
      <link>https://community.hpe.com/t5/operating-system-linux/setting-environment-variable-with-putenv-after-call-to-clearenv/m-p/3676029#M102819</link>
      <description>Killer and thanks.  I had tried the putting the "env = environ;" line after one other while(*env) loop, but not all.  Placing that line just before all the while(*env) loops solved the problem.  Guess I was under the assumption reseting the env pointer just after the clearenv() call would be all that was needed...</description>
      <pubDate>Mon, 21 Nov 2005 16:09:04 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/setting-environment-variable-with-putenv-after-call-to-clearenv/m-p/3676029#M102819</guid>
      <dc:creator>Steve Hosto</dc:creator>
      <dc:date>2005-11-21T16:09:04Z</dc:date>
    </item>
  </channel>
</rss>

