Opened 12 years ago
#5377 new Feature Requests
Use strerror_s to resolve error messages on Windows when possible
Reported by: | Owned by: | Beman Dawes | |
---|---|---|---|
Milestone: | To Be Determined | Component: | system |
Version: | Boost 1.46.0 | Severity: | Problem |
Keywords: | strerror strerror_s error_code error system | Cc: |
Description
In error_code.cpp, conditional macros choose the system call used to resolve error code values to strings (~line 81). The inline documentation mentions that strerror_r is used to provide thread-safety on platforms that expose that call.
However, for Windows, the strerror call is always used, which is not thread-safe.
Since VS2005, the Windows API has provided strerror_s, a thread-safe alternative to strerror that is similar to strerror_r.
If possible, the strerror_s call should be used on Windows platforms that provide it.
I am not an expert on the Boost way to select on Windows API versions internally so I hesitate to propose a patch but the form would be similar to that used for the strerror_r calls in that same area of the code.