mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-10-06 21:50:05 +02:00
glib/win32: introduce private g_win32_handle_is_socket()
Used in following commits, including in some GIO experiments. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
This commit is contained in:
@@ -1450,6 +1450,25 @@ g_win32_find_helper_executable_path (const gchar *executable_name, void *dll_han
|
||||
return executable_path;
|
||||
}
|
||||
|
||||
/*
|
||||
* g_win32_handle_is_socket:
|
||||
* @h: a win32 HANDLE
|
||||
*
|
||||
* Returns: %TRUE if the handle is a `SOCKET`.
|
||||
*/
|
||||
gboolean
|
||||
g_win32_handle_is_socket (HANDLE h)
|
||||
{
|
||||
int option = 0;
|
||||
int optlen = sizeof (option);
|
||||
|
||||
/* according to: https://stackoverflow.com/a/50981652/1277510, this is reasonable */
|
||||
if (getsockopt ((SOCKET) h, SOL_SOCKET, SO_DEBUG, (char *) &option, &optlen) == SOCKET_ERROR)
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*
|
||||
* g_win32_reopen_noninherited:
|
||||
* @fd: (transfer full): A file descriptor
|
||||
|
Reference in New Issue
Block a user