Re: [PATCH spice-xpi 1/2] xpi: use safer g_environ_setenv()

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

 



Hey,

On Mon, Jan 28, 2013 at 07:03:56PM +0100, Marc-André Lureau wrote:
> Quoting GLib:
> 
> Environment variable handling in UNIX is not thread-safe, and your
> program may crash if one thread calls g_setenv() while another thread
> is calling getenv(). (And note that many functions, such as gettext(),
> call getenv() internally.) This function is only safe to use at the
> very start of your program, before creating any other threads (or
> creating objects that create worker threads of their own).
> 
> If you need to set up the environment for a child process, you can use
> g_get_environ() to get an environment array, modify that with
> g_environ_setenv() and g_environ_unsetenv(), and then pass that array
> directly to execvpe(), g_spawn_async(), or the like.

Did you observe actual issues with that in spice-xpi, or is it just
theoritical? While the patches looks good, g_environ_setenv was added in
glib 2.32, which may be too recent.

Christophe

Attachment: pgp7kLwBoUi7C.pgp
Description: PGP signature

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/spice-devel

[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]