After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 676397 - g_environ_* should work with NULL envp
g_environ_* should work with NULL envp
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: general
unspecified
Other Linux
: Normal enhancement
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2012-05-19 21:58 UTC by Christian Persch
Modified: 2012-05-22 17:49 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
environ: Allow NULL envp (3.96 KB, patch)
2012-05-19 22:00 UTC, Christian Persch
reviewed Details | Review
environ: Allow NULL envp (4.63 KB, patch)
2012-05-20 10:58 UTC, Christian Persch
accepted-commit_now Details | Review

Description Christian Persch 2012-05-19 21:58:19 UTC
IMHO it would be convenient to treat NULL envp the same as an empty envp in g_environ_[un]setenv(), so you wouldn't have extra checks in your code for NULL/non-NULL env.
Comment 1 Christian Persch 2012-05-19 22:00:53 UTC
Created attachment 214464 [details] [review]
environ: Allow NULL envp
Comment 2 Matthias Clasen 2012-05-20 01:21:38 UTC
Review of attachment 214464 [details] [review]:

::: glib/genviron.c
@@ +75,3 @@
  *     list (eg, as returned from g_get_environ())
  * @variable: the environment variable to get, in the GLib file name
  *     encoding

Should probably document how NULL is interpreted here.
Comment 3 Christian Persch 2012-05-20 10:58:44 UTC
Created attachment 214481 [details] [review]
environ: Allow NULL envp
Comment 4 Colin Walters 2012-05-20 15:27:10 UTC
Review of attachment 214481 [details] [review]:

Looks good to me.
Comment 5 Christian Persch 2012-05-22 17:49:40 UTC
Pushed to master.