crypto/o_str.c: strerror_s is provided by specific compiler run-time,
authorAndy Polyakov <appro@openssl.org>
Thu, 26 May 2016 21:00:21 +0000 (23:00 +0200)
committerAndy Polyakov <appro@openssl.org>
Fri, 27 May 2016 21:01:37 +0000 (23:01 +0200)
not by OS [as was implied by guarding #if condition].

Reviewed-by: Matt Caswell <matt@openssl.org>
crypto/o_str.c

index 98eb1631cb044e5fa9fc8f996263ba1cc6f40416..4e2ef88e6139186ec4a95d3fba063e855708638c 100644 (file)
@@ -261,10 +261,8 @@ char *OPENSSL_buf2hexstr(const unsigned char *buffer, long len)
 
 int openssl_strerror_r(int errnum, char *buf, size_t buflen)
 {
-#if defined(OPENSSL_SYS_WINDOWS)
-    if (strerror_s(buf, buflen, errnum) == EINVAL)
-        return 0;
-    return 1;
+#if defined(_MSC_VER) && _MSC_VER>=1400
+    return !strerror_s(buf, buflen, errnum);
 #elif (_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600) && !_GNU_SOURCE
     /*
      * We can use "real" strerror_r. The OpenSSL version differs in that it