]> granicus.if.org Git - curl/commitdiff
configure: check for declaration of getpwuid_r
authorBernhard Walle <bernhard@bwalle.de>
Sun, 27 May 2018 17:51:04 +0000 (19:51 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Thu, 31 May 2018 10:51:15 +0000 (12:51 +0200)
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]

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 <bernhard@bwalle.de>
Closes #2609

configure.ac
lib/curl_setup.h

index f5f4e77173bfc7d49f3bdccb1789b06bb9dba299..9c4e697de5112a0ceb4b8b5ecc97b00975322d96 100755 (executable)
@@ -3618,6 +3618,11 @@ case $host in
     ;;
 esac
 
+AC_CHECK_DECLS([getpwuid_r], [], [AC_DEFINE(HAVE_DECL_GETPWUID_R_MISSING, 1, "Set if getpwuid_r() declaration is missing")],
+        [[#include <pwd.h>
+          #include <sys/types.h>]])
+
+
 AC_CHECK_FUNCS([geteuid \
   getpass_r \
   getppid \
index 5593a3b5c29e424b6b36792536df6c8d837a0260..9696a07d0840d901b718c987195ab2e089d7797f 100644 (file)
@@ -800,4 +800,11 @@ endings either CRLF or LF so 't' is appropriate.
 #define CURL_SA_FAMILY_T unsigned short
 #endif
 
+/* Some versions of the Android SDK is missing the declaration */
+#if defined(HAVE_GETPWUID_R) && defined(HAVE_DECL_GETPWUID_R_MISSING)
+struct passwd;
+int getpwuid_r(uid_t uid, struct passwd *pwd, char *buf,
+               size_t buflen, struct passwd **result);
+#endif
+
 #endif /* HEADER_CURL_SETUP_H */