Do not attempt to call child_setup on Windows
authorSimon McVittie <simon.mcvittie@collabora.co.uk>
Thu, 26 Nov 2015 10:37:48 +0000 (10:37 +0000)
committerSimon McVittie <smcv@debian.org>
Fri, 27 Nov 2015 10:03:06 +0000 (10:03 +0000)
commit420f3474ed4c0427d71eb88f42bf464eeab31ff2
treee73292d0ec53c6fa39a3238443fedc486e758a7e
parent7c7f4a5110330255ee630c50a08fc159a15981d0
Do not attempt to call child_setup on Windows

child_setup() is defined to be called after fork() and before exec(),
but Windows' process model does not have fork(): the equivalent of
those two operations is a single CreateProcess() call. This means
that there is no point at which we could call child_setup() and
have it affect only the child's process-global state. At the point
where it is currently executed, it affects the parent's process-global
state instead, which would be actively harmful if we used any
child_setup() function that was not a no-op on Windows.

The equivalent function in GLib, g_spawn_async_with_pipes(), documents
child_setup() as unused on Windows. Do the same here.

In practice, our only use of child_setup() outside tests
is #ifdef DBUS_UNIX anyway, so this change has no practical effect
right now.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=85857
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
dbus/dbus-spawn-win.c
dbus/dbus-spawn.c