Author: phater
Date: Fri May 26 11:51:33 2017
New Revision: 74669

URL: http://svn.reactos.org/svn/reactos?rev=74669&view=rev
Log:
[WS2_32] Set last error on exit on some functions

Modified:
    trunk/reactos/dll/win32/ws2_32/src/socklife.c

Modified: trunk/reactos/dll/win32/ws2_32/src/socklife.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ws2_32/src/socklife.c?rev=74669&r1=74668&r2=74669&view=diff
==============================================================================
--- trunk/reactos/dll/win32/ws2_32/src/socklife.c       [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/ws2_32/src/socklife.c       [iso-8859-1] Fri May 26 
11:51:33 2017
@@ -59,7 +59,11 @@
                 WsSockDereference(Socket);
 
                 /* Return Provider Value */
-                if (Status == ERROR_SUCCESS) return Status;
+                if (Status == ERROR_SUCCESS)
+                {
+                    SetLastError(ErrorCode);
+                    return Status;
+                }
 
                 /* If everything seemed fine, then the WSP call failed itself 
*/
                 if (ErrorCode == NO_ERROR) ErrorCode = WSASYSCALLFAILURE;
@@ -120,7 +124,11 @@
                 WsSockDereference(Socket);
 
                 /* Return success if everything is OK */
-                if (ErrorCode == ERROR_SUCCESS) return ErrorCode;
+                if (ErrorCode == ERROR_SUCCESS)
+                {
+                    SetLastError(ErrorCode);
+                    return ErrorCode;
+                }
             }
         }
         else
@@ -347,6 +355,7 @@
                 }
 
                 /* Return */
+                SetLastError(ErrorCode);
                 return Status;
             }
         }
@@ -421,6 +430,7 @@
                 }
 
                 /* Return */
+                SetLastError(ErrorCode);
                 return Status;
             }
         }
@@ -582,6 +592,7 @@
         {
             /* Add an API reference and return */
             WsSockAddApiReference(Status);
+            SetLastError(ErrorCode);
             return Status;
         }
     }


Reply via email to