[libcxx] r291336 - system_error: correct ELAST emulation on Windows

Saleem Abdulrasool via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 6 21:13:32 PST 2017


Author: compnerd
Date: Fri Jan  6 23:13:32 2017
New Revision: 291336

URL: http://llvm.org/viewvc/llvm-project?rev=291336&view=rev
Log:
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!

Modified:
    libcxx/trunk/src/include/config_elast.h

Modified: libcxx/trunk/src/include/config_elast.h
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/include/config_elast.h?rev=291336&r1=291335&r2=291336&view=diff
==============================================================================
--- libcxx/trunk/src/include/config_elast.h (original)
+++ libcxx/trunk/src/include/config_elast.h Fri Jan  6 23:13:32 2017
@@ -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




More information about the cfe-commits mailing list