mirror of
				https://github.com/asterisk/asterisk.git
				synced 2025-10-31 02:37:10 +00:00 
			
		
		
		
	FreeBSD fix for utils (bug #1949)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@3352 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
		| @@ -32,6 +32,9 @@ extern int test_for_thread_safety(void); | ||||
| extern const char *ast_inet_ntoa(char *buf, int bufsiz, struct in_addr ia); | ||||
| extern int ast_utils_init(void); | ||||
|  | ||||
| #ifdef inet_ntoa | ||||
| #undef inet_ntoa | ||||
| #endif | ||||
| #define inet_ntoa __dont__use__inet_ntoa__use__ast_inet_ntoa__instead__ | ||||
|  | ||||
| #endif | ||||
|   | ||||
							
								
								
									
										6
									
								
								utils.c
									
									
									
									
									
								
							
							
						
						
									
										6
									
								
								utils.c
									
									
									
									
									
								
							| @@ -14,6 +14,7 @@ | ||||
| #include <unistd.h> | ||||
| #include <sys/types.h> | ||||
| #include <sys/socket.h> | ||||
| #include <netinet/in.h> | ||||
| #include <arpa/inet.h> | ||||
| #include <asterisk/lock.h> | ||||
| #include <asterisk/utils.h> | ||||
| @@ -29,6 +30,7 @@ static char b2a[256]; | ||||
|  | ||||
| AST_MUTEX_DEFINE_STATIC(__mutex); | ||||
|  | ||||
| /* Recursive replacement for gethostbyname for BSD-based systems */ | ||||
| static int gethostbyname_r (const char *name, struct hostent *ret, char *buf, | ||||
| 				size_t buflen, struct hostent **result,  | ||||
| 				int *h_errnop)  | ||||
| @@ -126,6 +128,9 @@ static int gethostbyname_r (const char *name, struct hostent *ret, char *buf, | ||||
|  | ||||
| #endif | ||||
|  | ||||
| /* Recursive thread safe version of gethostbyname that replaces the  | ||||
|    standard gethostbyname (which is not recursive) | ||||
| */ | ||||
| struct hostent *ast_gethostbyname(const char *host, struct ast_hostent *hp) | ||||
| { | ||||
| 	int res; | ||||
| @@ -328,6 +333,7 @@ static void base64_init(void) | ||||
| #endif | ||||
| } | ||||
|  | ||||
| /* Recursive thread safe replacement of inet_ntoa */ | ||||
| const char *ast_inet_ntoa(char *buf, int bufsiz, struct in_addr ia) | ||||
| { | ||||
| 	return inet_ntop(AF_INET, &ia, buf, bufsiz); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user