summaryrefslogtreecommitdiff
path: root/dbus/dbus-sysdeps.c
diff options
context:
space:
mode:
authorTor Lillqvist <tml@iki.fi>2009-10-22 13:19:23 +0300
committerRalf Habacker <ralf.habacker@freenet.de>2009-12-01 10:28:05 +0100
commit9bb7297ad72dbefed15da22cb22cf8ac3547b7ca (patch)
tree78f917ceccfa1adc194fb3b92b3fb8c49d05f68f /dbus/dbus-sysdeps.c
parentd9e4725fa93d03368a81f0aa3cb8e66800d96c65 (diff)
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.
Diffstat (limited to 'dbus/dbus-sysdeps.c')
-rw-r--r--dbus/dbus-sysdeps.c48
1 files changed, 26 insertions, 22 deletions
diff --git a/dbus/dbus-sysdeps.c b/dbus/dbus-sysdeps.c
index 68cea273..74be7dbb 100644
--- a/dbus/dbus-sysdeps.c
+++ b/dbus/dbus-sysdeps.c
@@ -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;