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
curl_setup_once: Remove ERRNO/SET_ERRNO macros #1589
Conversation
@jay, thanks for your PR! By analyzing the history of the files in this pull request, we identified @aYasuharuYamada, @bagder and @yangtse to be potential reviewers. |
Seems you forgot something in |
fixed, thanks. tested with CPPFLAGS=-DMEMDEBUG_LOG_SYNC and --enable-debug |
|
Prior to this change (SET_)ERRNO mapped to GetLastError/SetLastError for Win32 and regular errno otherwise. I reviewed the code and found no justifiable reason for conflating errno on WIN32 with GetLastError/SetLastError. All Win32 CRTs support errno, and any Win32 multithreaded CRT supports thread-local errno. Fixes curl#895
Ok I think I got them all. The functions in strerror.c can modify errno so it's saved beforehand, and now that the Windows API error code is separate from errno it should be preserved as well. I had changed the code to do that but did not guard one of the sections as Windows, oops. I've since made some more robust changes to correct it, we'll see what the CI says.. |
@MarcelRaad Confirmed. Patch: --- a/memdebug.c 2017-07-10 11:00:17
+++ b/memdebug.c 2017-07-10 10:27:25
@@ -147,7 +147,7 @@
source, line, func);
fflush(logfile); /* because it might crash now */
}
- errno = ENOMEM;
+ SET_ERRNO(ENOMEM);
return TRUE; /* RETURN ERROR! */
}
else |
This is a follow-up to af02162 which removed (SET_)ERRNO macros. That commit was an earlier draft that I committed by mistake, which was then remedied by a5834e5 and e909de6, and now this commit. With this commit there is now no difference between the current code and the changes that were approved in the final draft. Thanks-to: Max Dymond, Marcel Raad, Daniel Stenberg, Gisle Vanem Ref: curl#1589
Thanks guys, I had mistakenly committed an older draft because my repos were out of sync. I just committed the rest in c5e87fd, so there is now no difference between the current code and the changes that were approved in the final draft. |
Prior to this change (SET_)ERRNO mapped to GetLastError/SetLastError
for Win32 and regular errno otherwise.
I reviewed the code and found no justifiable reason for conflating errno
on WIN32 with GetLastError/SetLastError. All Win32 CRTs support errno,
and any Win32 multithreaded CRT supports thread-local errno.
Fixes #895