From 4475d698142712dcdeb8c40526ed411003b1c2a4 Mon Sep 17 00:00:00 2001 From: Jef Driesen Date: Thu, 21 Jan 2016 20:05:42 +0100 Subject: [PATCH] Use the error code returned by the WSAStartup function. Unlike the other socket functions, the WSAStartup() function returns the extended error code directly. A call to the WSAGetLastError() function is not needed and should not be used. --- src/irda.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/irda.c b/src/irda.c index 3be1151..a361eb8 100644 --- a/src/irda.c +++ b/src/irda.c @@ -90,8 +90,9 @@ irda_socket_open (irda_t **out, dc_context_t *context) // Initialize the winsock dll. WSADATA wsaData; WORD wVersionRequested = MAKEWORD (2, 2); - if (WSAStartup (wVersionRequested, &wsaData) != 0) { - SYSERROR (context, ERRNO); + int rc = WSAStartup (wVersionRequested, &wsaData); + if (rc != 0) { + SYSERROR (context, rc); goto error_free; }