Forward port [18313] and [18314]. compile fix
authorChristophe Mutricy <xtophe@videolan.org>
Thu, 7 Dec 2006 20:19:52 +0000 (20:19 +0000)
committerChristophe Mutricy <xtophe@videolan.org>
Thu, 7 Dec 2006 20:19:52 +0000 (20:19 +0000)
modules/misc/gnutls.c

index f60daae..58a052a 100644 (file)
@@ -155,11 +155,18 @@ static int gnutls_Error (vlc_object_t *obj, int val)
     switch (val)
     {
         case GNUTLS_E_AGAIN:
+#if ! defined(WIN32)
             errno = EAGAIN;
             break;
+#endif
+            /* WinSock does not return EAGAIN, return EINTR instead */
 
         case GNUTLS_E_INTERRUPTED:
+#if defined(WIN32)
+            WSASetLastError(WSAEINTR);
+#else
             errno = EINTR;
+#endif
             break;
 
         default:
@@ -168,7 +175,11 @@ static int gnutls_Error (vlc_object_t *obj, int val)
             if (!gnutls_error_is_fatal (val))
                 msg_Err (obj, "Error above should be handled");
 #endif
+#if defined(WIN32)
+            WSASetLastError(WSAECONNRESET);
+#else
             errno = ECONNRESET;
+#endif
     }
     return -1;
 }