#endif
-
-
-void
+/**
+ * @returns #FALSE if no memory
+ */
+dbus_bool_t
_dbus_win_startup_winsock (void)
{
/* Straight from MSDN, deuglified */
+ /* Protected by _DBUS_LOCK_sysdeps */
static dbus_bool_t beenhere = FALSE;
WORD wVersionRequested;
WSADATA wsaData;
int err;
+ if (!_DBUS_LOCK (sysdeps))
+ return FALSE;
+
if (beenhere)
- return;
+ goto out;
wVersionRequested = MAKEWORD (2, 0);
}
beenhere = TRUE;
+
+out:
+ _DBUS_UNLOCK (sysdeps);
+ return TRUE;
}
int len;
u_long arg;
- _dbus_win_startup_winsock ();
+ if (!_dbus_win_startup_winsock ())
+ {
+ _DBUS_SET_OOM (error);
+ return FALSE;
+ }
temp = socket (AF_INET, SOCK_STREAM, 0);
if (temp == INVALID_SOCKET)
_DBUS_ASSERT_ERROR_IS_CLEAR (error);
- _dbus_win_startup_winsock ();
+ if (!_dbus_win_startup_winsock ())
+ {
+ _DBUS_SET_OOM (error);
+ return -1;
+ }
_DBUS_ZERO (hints);
*fds_p = NULL;
_DBUS_ASSERT_ERROR_IS_CLEAR (error);
- _dbus_win_startup_winsock ();
+ if (!_dbus_win_startup_winsock ())
+ {
+ _DBUS_SET_OOM (error);
+ return -1;
+ }
_DBUS_ZERO (hints);