Blob Blame History Raw
autoconf: Do not call exit in the getaddrinfo check

The exit function is not declared in this context, so the check
will always fail with compilers which do not accept implicit function
declarations.  Change the return type of main to int and return
directly from main instead.

Submitted upstream: <https://gitlab.bacula.org/bacula-community-edition/bacula-community/-/issues/2666>

diff --git a/autoconf/configure.in b/autoconf/configure.in
index 56cb94e9a904b47d..937ad330fb68d77b 100644
--- a/autoconf/configure.in
+++ b/autoconf/configure.in
@@ -2585,7 +2585,7 @@ AC_CACHE_CHECK(for working getaddrinfo, ac_cv_working_getaddrinfo,
 	      #include <sys/types.h>
 	      #include <sys/socket.h>
 
-	      void main(void) {
+	      int main(void) {
 		  struct addrinfo hints, *ai;
 		  int error;
 
@@ -2594,12 +2594,12 @@ AC_CACHE_CHECK(for working getaddrinfo, ac_cv_working_getaddrinfo,
 		  hints.ai_socktype = SOCK_STREAM;
 		  error = getaddrinfo("127.0.0.1", NULL, &hints, &ai);
 		  if (error) {
-		      exit(1);
+		      return 1;
 		  }
 		  if (ai->ai_addr->sa_family != AF_INET) {
-		      exit(1);
+		      return 1;
 		  }
-		  exit(0);
+		  return 0;
 	      }
 	  ],[
 	      ac_cv_working_getaddrinfo="yes"