Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
GitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
The declaration is just missing in the header, the problem is that the configure check just checks if the function is available at link-time, not if it's declared.
I know that the toolchain is a bit older, but we're still using that one.
@snikulov Well, the CMake thing has nothing todo with Android. The check for
I discovered the issue when checking whether the declaration of
You can of course do what you want, but I still consider it a lame "fix". It just disables the use of the function so instead you'll use a function that isn't thread-safe. A more proper fix would be to instead provide a private prototype to avoid the warning when the correct function is used!
The cmake fix is valid and I'll merge!
I believe a proper fix for this broken NDK would be as following (assuming I've understood this correctly):
1 - detect the lack of
#ifdef HAVE_NO_GETPWUID_R_PROTO int getpwuid_r(uid_t uid, struct passwd *pwd, char *buf, size_t buflen, struct passwd **result); #endif
And yes, it figured out this:
It highlights this problem: only the configure script will define
I would prefer if the configure script defines name for the reverse: when the prototype is found to be missing as then we could be sure that only systems for which configure has detected a missing prototype would use this custom one.
On our x86 Android toolchain, getpwuid_r is implemented but the header is missing: netrc.c:81:7: error: implicit declaration of function 'getpwuid_r' [-Werror=implicit-function-declaration] if(!getpwuid_r(geteuid(), &pw, pwbuf, sizeof(pwbuf), &pw_res) ^ Unfortunately, the function is used in curl_ntlm_wb.c, too, so I moved the prototype to curl_setup.h. Signed-off-by: Bernhard Walle <email@example.com>