The stdout FD passed to dbus-daemon is propagated to all its child
processes, such as service activated processes. If we close the FD after
reading the bus address from the daemon, any child process which
subsequently writes to stdout (e.g. for logging) will get a SIGPIPE and
explode.
Instead of closing the stdout FD immediately after dbus-daemon has
spawned, keep it open until the daemon is killed.
https://bugzilla.gnome.org/show_bug.cgi?id=732019
Windows does not like g_unlink() to be called on files whose file
descriptor is still open, so doing that would cause a permission
denied error. Since the fd is not used in that function after
acquiring the temp file, close it earlier before
g_file_set_contents(), so that it can complete successfully.
This fixes a number of GTK+ tests on Windows.
https://bugzilla.gnome.org/show_bug.cgi?id=719344
In Windows development environments that have it, <unistd.h> is mostly
just a wrapper around several other native headers (in particular,
<io.h>, which contains read(), close(), etc, and <process.h>, which
contains getpid()). But given that some Windows dev environments don't
have <unistd.h>, everything that uses those functions on Windows
already needed to include the correct Windows header as well, and so
there is never any point to including <unistd.h> on Windows.
Also, remove some <unistd.h> includes (and a few others) that were
unnecessary even on unix.
https://bugzilla.gnome.org/show_bug.cgi?id=710519
As it turns out, we have examples of internal functions called
type_name_get_private() in the wild (especially among older libraries),
so we need to use a name for the per-instance private data getter
function that hopefully won't conflict with anything.
Rather than defining _WIN32_WINNT only in a handful of files, define
it in config.h, like we do with _GNU_SOURCE.
(Also remove a "#define WIN32_LEAN_AND_MEAN" that isn't really all
that useful.)
https://bugzilla.gnome.org/show_bug.cgi?id=688109
-glib/gmarkup.c: Use G_VA_COPY() instead of va_copy() as va_copy() may not
be universally available.
-gio/gtestdbus.c: Include io.h on Windows for close()
Using GIO here may cause the gvfs module to be loaded, which
in turn gets onto the session bus to talk to gvfsd - not ideal
if you are trying to control the session bus life cycle. Instead,
just use old-fashioned glib file utils.
-gconverterinputstream.c: Avoid GCCism by not using non-standard pointer
arithmetic on void*, but do a cast to char * as that seems to be what the
variable was used for.
-gtestdbus.c: Don't include unistd.h unconditionally, and use g_usleep()
instead of usleep(), as usleep() is not universally available.