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
This commit is contained in:
Saleem Abdulrasool
2017-01-07 05:13:32 +00:00
parent 678eadd13f
commit 5bea45dea1

View File

@@ -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