From f89bed9571d2e4a17f11e206c164a348dc4ec3b8 Mon Sep 17 00:00:00 2001 From: Marc Hoersken Date: Mon, 15 Dec 2014 01:00:36 +0100 Subject: [PATCH] tests on Windows: check for WSAStartup return code Fixes VS2012 code analysis warning C6031: return value ignored: could return unexpected value --- tests/ssh2.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/tests/ssh2.c b/tests/ssh2.c index e09ba8a..a668947 100644 --- a/tests/ssh2.c +++ b/tests/ssh2.c @@ -39,17 +39,23 @@ int main(int argc, char *argv[]) char *userauthlist; LIBSSH2_SESSION *session; LIBSSH2_CHANNEL *channel; -#ifdef WIN32 - WSADATA wsadata; - - WSAStartup(MAKEWORD(2,0), &wsadata); -#endif const char *pubkeyfile="etc/user.pub"; const char *privkeyfile="etc/user"; const char *username="username"; const char *password="password"; int ec = 1; +#ifdef WIN32 + WSADATA wsadata; + int err; + + err = WSAStartup(MAKEWORD(2,0), &wsadata); + if (err != 0) { + fprintf(stderr, "WSAStartup failed with error: %d\n", err); + return -1; + } +#endif + (void)argc; (void)argv;