gutils: Add functions for working with environment arrays
authorDan Winship <danw@gnome.org>
Sat, 15 Oct 2011 19:52:28 +0000 (15:52 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Sat, 15 Oct 2011 19:54:45 +0000 (15:54 -0400)
commit409d93148f2d95c2966f75fe0901edd1e06c99a9
tree2d96297c3bb9d21f0da809870b28883ca5b0abaa
parent5ff803d91f252bfeb4a9cfaf2f94ecdea6e6a687
gutils: Add functions for working with environment arrays

When spawning a child process, it is not safe to call setenv() before
the fork() (because setenv() isn't thread-safe), but it's also not
safe to call it after the fork() (because it's not async-signal-safe).
So the only safe way to alter the environment for a child process from
a threaded program is to pass a fully-formed envp array to
exec*/g_spawn*/etc.

So, add g_environ_getenv(), g_environ_setenv(), and
g_environ_unsetenv(), which act like their namesakes, but work on
arbitrary arrays rather than working directly on the environment.

http://bugzilla.gnome.org/show_bug.cgi?id=659326
docs/reference/glib/glib-sections.txt
glib/glib.symbols
glib/gspawn.h
glib/gutils.c
glib/gutils.h