bug-gnulib
[Top][All Lists]
Advanced

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

[PATCH] doc: mention environ pitfall


From: Eric Blake
Subject: [PATCH] doc: mention environ pitfall
Date: Thu, 31 May 2018 08:54:54 -0500

Based on a bug report to the Cygwin list:
https://cygwin.com/ml/cygwin/2018-05/msg00321.html

* 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?

 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
 @item
 The address of this variable is not a compile-time constant on some platforms:
 mingw.
address@hidden
+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
-- 
2.14.3




reply via email to

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