From 5bea45dea17c136ac8134296af12899f521beea4 Mon Sep 17 00:00:00 2001 From: Saleem Abdulrasool Date: Sat, 7 Jan 2017 05:13:32 +0000 Subject: [PATCH] system_error: correct ELAST emulation on Windows ELAST should point to the last valid error string value. However, `_sys_nerr` provides the number of elements in the errlist array. Since the index is 0-based, this is off-by-one. Adjust it accordingly. Thanks to David Majnemer for catching this! git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@291336 91177308-0d34-0410-b5e6-96231b3b80d8 --- src/include/config_elast.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/include/config_elast.h b/src/include/config_elast.h index 97104290d..8328978ef 100644 --- a/src/include/config_elast.h +++ b/src/include/config_elast.h @@ -31,7 +31,7 @@ #elif defined(__sun__) #define _LIBCPP_ELAST ESTALE #elif defined(_LIBCPP_MSVCRT) -#define _LIBCPP_ELAST _sys_nerr +#define _LIBCPP_ELAST (_sys_nerr - 1) #else // Warn here so that the person doing the libcxx port has an easier time: #warning ELAST for this platform not yet implemented