summaryrefslogtreecommitdiff
path: root/lib/strerror.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2017-07-10 13:58:35 +0200
committerng0 <ng0@infotropique.org>2017-08-22 15:29:43 +0000
commit2ead37f680d090807ac1968527d06671f907c6d8 (patch)
tree49de8987f7fd67dbd27b62018e70f6ab073f91d0 /lib/strerror.c
parentbfbb92604ba1cf6a757599d6fd9d13e9160d892a (diff)
downloadgnurl-2ead37f680d090807ac1968527d06671f907c6d8.tar.gz
gnurl-2ead37f680d090807ac1968527d06671f907c6d8.tar.bz2
gnurl-2ead37f680d090807ac1968527d06671f907c6d8.zip
errno: fix non-windows builds after af0216251b94e7
Diffstat (limited to 'lib/strerror.c')
-rw-r--r--lib/strerror.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/strerror.c b/lib/strerror.c
index 35dc0a421..a85c216a5 100644
--- a/lib/strerror.c
+++ b/lib/strerror.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 2004 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 2004 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -631,14 +631,16 @@ const char *Curl_strerror(struct connectdata *conn, int err)
char *buf, *p;
size_t max;
int old_errno;
+#ifdef WIN32
DWORD old_win_err;
-
+#endif
DEBUGASSERT(conn);
DEBUGASSERT(err >= 0);
old_errno = errno;
+#ifdef WIN32
old_win_err = GetLastError();
-
+#endif
buf = conn->syserr_buf;
max = sizeof(conn->syserr_buf)-1;
*buf = '\0';
@@ -725,10 +727,10 @@ const char *Curl_strerror(struct connectdata *conn, int err)
p = strrchr(buf, '\r');
if(p && (p - buf) >= 1)
*p = '\0';
-
+#ifdef WIN32
if(old_win_err != GetLastError())
SetLastError(old_win_err);
-
+#endif
if(errno != old_errno)
errno = old_errno;