]> granicus.if.org Git - curl/commitdiff
errno: fix non-windows builds after af0216251b94e7
authorDaniel Stenberg <daniel@haxx.se>
Mon, 10 Jul 2017 11:58:35 +0000 (13:58 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Mon, 10 Jul 2017 11:59:05 +0000 (13:59 +0200)
lib/memdebug.c
lib/strerror.c

index 16434f819ecc5ef2954fb91c7484a7d4a573a5f4..8c9fe950234dfb858ba428d3c62274383c54328f 100644 (file)
@@ -147,7 +147,7 @@ static bool countcheck(const char *func, int line, const char *source)
                 source, line, func);
         fflush(logfile); /* because it might crash now */
       }
-      SET_ERRNO(ENOMEM);
+      errno = ENOMEM;
       return TRUE; /* RETURN ERROR! */
     }
     else
index 35dc0a421af141c9c1a5044ce74500869830d400..a85c216a51994714f0b62f13d56cce68110d273f 100644 (file)
@@ -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;