mirror of
https://gitlab.freedesktop.org/dbus/dbus.git
synced 2026-01-19 21:20:34 +01:00
Handle also WinSock errors in _dbus_error_from_errno
Handle those WinSock errors that match the errno values handled. Don't bother handling those errors that are mapped to DBUS_ERROR_FAILED in the switch as that is the default return value anyway.
This commit is contained in:
parent
d9e4725fa9
commit
9bb7297ad7
1 changed files with 26 additions and 22 deletions
|
|
@ -940,8 +940,8 @@ _dbus_generate_random_ascii (DBusString *str,
|
|||
}
|
||||
|
||||
/**
|
||||
* Converts a UNIX or Windows errno
|
||||
* into a #DBusError name.
|
||||
* Converts a UNIX errno, or Windows errno or WinSock error value into
|
||||
* a #DBusError name.
|
||||
*
|
||||
* @todo should cover more errnos, specifically those
|
||||
* from open().
|
||||
|
|
@ -961,10 +961,18 @@ _dbus_error_from_errno (int error_number)
|
|||
case EPROTONOSUPPORT:
|
||||
return DBUS_ERROR_NOT_SUPPORTED;
|
||||
#endif
|
||||
#ifdef WSAEPROTONOSUPPORT
|
||||
case WSAEPROTONOSUPPORT:
|
||||
return DBUS_ERROR_NOT_SUPPORTED;
|
||||
#endif
|
||||
#ifdef EAFNOSUPPORT
|
||||
case EAFNOSUPPORT:
|
||||
return DBUS_ERROR_NOT_SUPPORTED;
|
||||
#endif
|
||||
#ifdef WSAEAFNOSUPPORT
|
||||
case WSAEAFNOSUPPORT:
|
||||
return DBUS_ERROR_NOT_SUPPORTED;
|
||||
#endif
|
||||
#ifdef ENFILE
|
||||
case ENFILE:
|
||||
return DBUS_ERROR_LIMITS_EXCEEDED; /* kernel out of memory */
|
||||
|
|
@ -989,42 +997,38 @@ _dbus_error_from_errno (int error_number)
|
|||
case ENOMEM:
|
||||
return DBUS_ERROR_NO_MEMORY;
|
||||
#endif
|
||||
#ifdef EINVAL
|
||||
case EINVAL:
|
||||
return DBUS_ERROR_FAILED;
|
||||
#endif
|
||||
#ifdef EBADF
|
||||
case EBADF:
|
||||
return DBUS_ERROR_FAILED;
|
||||
#endif
|
||||
#ifdef EFAULT
|
||||
case EFAULT:
|
||||
return DBUS_ERROR_FAILED;
|
||||
#endif
|
||||
#ifdef ENOTSOCK
|
||||
case ENOTSOCK:
|
||||
return DBUS_ERROR_FAILED;
|
||||
#endif
|
||||
#ifdef EISCONN
|
||||
case EISCONN:
|
||||
return DBUS_ERROR_FAILED;
|
||||
#endif
|
||||
#ifdef ECONNREFUSED
|
||||
case ECONNREFUSED:
|
||||
return DBUS_ERROR_NO_SERVER;
|
||||
#endif
|
||||
#ifdef WSAECONNREFUSED
|
||||
case WSAECONNREFUSED:
|
||||
return DBUS_ERROR_NO_SERVER;
|
||||
#endif
|
||||
#ifdef ETIMEDOUT
|
||||
case ETIMEDOUT:
|
||||
return DBUS_ERROR_TIMEOUT;
|
||||
#endif
|
||||
#ifdef WSAETIMEDOUT
|
||||
case WSAETIMEDOUT:
|
||||
return DBUS_ERROR_TIMEOUT;
|
||||
#endif
|
||||
#ifdef ENETUNREACH
|
||||
case ENETUNREACH:
|
||||
return DBUS_ERROR_NO_NETWORK;
|
||||
#endif
|
||||
#ifdef WSAENETUNREACH
|
||||
case WSAENETUNREACH:
|
||||
return DBUS_ERROR_NO_NETWORK;
|
||||
#endif
|
||||
#ifdef EADDRINUSE
|
||||
case EADDRINUSE:
|
||||
return DBUS_ERROR_ADDRESS_IN_USE;
|
||||
#endif
|
||||
#ifdef WSAEADDRINUSE
|
||||
case WSAEADDRINUSE:
|
||||
return DBUS_ERROR_ADDRESS_IN_USE;
|
||||
#endif
|
||||
#ifdef EEXIST
|
||||
case EEXIST:
|
||||
return DBUS_ERROR_FILE_EXISTS;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue