-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
strerror: use sys_errlist instead of strerror on Windows #7735
Conversation
- Change Curl_strerror to use sys_errlist[errnum] instead of strerror to retrieve the error message on Windows. Windows' strerror writes to a static buffer and is not thread-safe. Follow-up to 2f0bb86 which removed most instances of strerror in favor of calling Curl_strerror (which calls strerror_r for other platforms). Ref: curl#7685 Ref: curl@2f0bb86 Closes #xxxx
e2f4a3f
to
b8d9a72
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
@jay it seems like Microsoft deprecated direct access to
|
Yes that's right however it's in all versions of the CRT and strerror_s is not. |
Okay, what do you think about checking for the availability of |
I'm not aware of runtime checks for CRT functions so it would require a compile time check. The documentation does not say when the function was introduced. Frankly I don't think some of these "deprecations" from MS are true, like we're not going to stop using strncpy for strncpy_s or any of the other functions for the _s series. So I appreciate the point if you want to make a PR for strerror_s I won't object I just think it's sufficient as is. |
Note also how they define deprecated: In this context, "deprecated" means using the function's isn't recommended. It doesn't mean the function is scheduled to be removed from the CRT. |
retrieve the error message on Windows.
Windows' strerror writes to a static buffer and is not thread-safe.
Follow-up to 2f0bb86 which removed most instances of strerror in favor
of calling Curl_strerror (which calls strerror_r for other platforms).
Ref: #7685
Ref: 2f0bb86
Closes #xxxx