• Simon McVittie's avatar
    Split _dbus_fd_set_close_on_exec into Unix and Windows versions · 3765075c
    Simon McVittie authored
    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
    3765075c
dbus-server-launchd.c 6.95 KB