Split _dbus_fd_set_close_on_exec into Unix and Windows versions
authorSimon McVittie <simon.mcvittie@collabora.co.uk>
Thu, 11 Sep 2014 11:04:04 +0000 (12:04 +0100)
committerRalf Habacker <ralf.habacker@freenet.de>
Mon, 15 Sep 2014 11:31:22 +0000 (13:31 +0200)
commit3765075c5f7c115abd10b0b76df81ae230ffceae
treeace36c88949926949239d34c5abfe7cae2c9d34b
parent31b38090183b8bd77c86c1195d57b4a3b5df04da
Split _dbus_fd_set_close_on_exec into Unix and Windows versions

On Unix, the thing that can be made close-on-exec is a file descriptor,
which is an int.

On Windows, the thing that can be made close-on-exec is a HANDLE,
which is pointer-sized (but not necessarily a pointer!). In practice,
on Windows we only called _dbus_fd_set_close_on_exec() on socket
pseudo-file-descriptors (SOCKET, which is an unsigned int);
every SOCKET can validly be cast to HANDLE, but not every HANDLE
is a SOCKET.

Before this commit we used an intptr_t as a sort of fake
union { int; HANDLE; }, which just obscures what's going on.

In practice, everything that called _dbus_fd_set_close_on_exec()
is really platform-specific anyway, so let's just have two separate
functions and call this solved.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=39610
dbus/dbus-server-launchd.c
dbus/dbus-sysdeps-unix.c
dbus/dbus-sysdeps-unix.h
dbus/dbus-sysdeps-win.c
dbus/dbus-sysdeps.h