You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by tr...@apache.org on 2001/12/25 13:26:26 UTC
cvs commit: apr/network_io/unix sa_common.c
trawick 01/12/25 04:26:26
Modified: network_io/unix sa_common.c
Log:
AIX 5L getaddrinfo() returns an error when "0" is passed for the
service name parameter, so pass NULL when port is 0
Revision Changes Path
1.46 +9 -2 apr/network_io/unix/sa_common.c
Index: sa_common.c
===================================================================
RCS file: /home/cvs/apr/network_io/unix/sa_common.c,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -r1.45 -r1.46
--- sa_common.c 2001/09/12 19:46:12 1.45
+++ sa_common.c 2001/12/25 12:26:26 1.46
@@ -342,6 +342,7 @@
apr_sockaddr_t *cursa;
int error;
char num[8];
+ char *numptr;
memset(&hints, 0, sizeof(hints));
hints.ai_flags = 0; /* XXX: might need a way to turn on AI_CANONNAME */
@@ -356,8 +357,14 @@
hints.ai_family = family;
hints.ai_socktype = SOCK_STREAM;
hints.ai_protocol = 0;
- apr_snprintf(num, sizeof(num), "%d", port);
- error = getaddrinfo(hostname, num, &hints, &ai_list);
+ if (port) {
+ apr_snprintf(num, sizeof(num), "%d", port);
+ numptr = num;
+ }
+ else {
+ numptr = NULL;
+ }
+ error = getaddrinfo(hostname, numptr, &hints, &ai_list);
if (error) {
if (error == EAI_SYSTEM) {
return errno;