[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] doc: mention environ pitfall

From: Eric Blake
Subject: Re: [PATCH] doc: mention environ pitfall
Date: Wed, 5 Sep 2018 13:26:26 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1

On 05/31/2018 08:54 AM, Eric Blake wrote:
Based on a bug report to the Cygwin list:

* doc/posix-functions/environ.texi (environ): Assigning NULL to
environ is a glibc extension.

Signed-off-by: Eric Blake <address@hidden>

Does anyone have a better list of platforms where environ=NULL
actually fails, or should I just leave this text as written here?

No answer, so I pushed the patch.

  ChangeLog                        | 6 ++++++
  doc/posix-functions/environ.texi | 6 ++++++
  2 files changed, 12 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index b23b10919..5aaa8b708 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2018-05-31  Eric Blake  <address@hidden>
+       doc: mention environ pitfall
+       * doc/posix-functions/environ.texi (environ): Assigning NULL to
+       environ is a glibc extension.
  2018-05-27  Colin Watson  <address@hidden>

        bootstrap: document source fetching in --help
diff --git a/doc/posix-functions/environ.texi b/doc/posix-functions/environ.texi
index a6c00958d..6d1b8cfaa 100644
--- a/doc/posix-functions/environ.texi
+++ b/doc/posix-functions/environ.texi
@@ -34,4 +34,10 @@ environ
  The address of this variable is not a compile-time constant on some platforms:
+Assigning NULL to @code{environ} to clear all variables is not
+portable; better is to assign @code{environ} to one-element array
+containing a NULL pointer.  That said, an empty environment is not
+portable either, as some systems require particular environment
+variables to be present to operate consistently.
  @end itemize

Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org

reply via email to

[Prev in Thread] Current Thread [Next in Thread]