diff options
author | Wayne Davison <wayned@samba.org> | 2011-07-16 15:42:32 -0700 |
---|---|---|
committer | Wayne Davison <wayned@samba.org> | 2011-07-16 16:16:04 -0700 |
commit | 0a04a80d9f3caeffce4d7daddf5730034602073d (patch) | |
tree | 0741fa2574e807d752c493768c05c807444f574e /socket.c | |
parent | 7ae666d2a76a5d116ddaefeeae42da92ba453583 (diff) | |
download | android_external_rsync-0a04a80d9f3caeffce4d7daddf5730034602073d.tar.gz android_external_rsync-0a04a80d9f3caeffce4d7daddf5730034602073d.tar.bz2 android_external_rsync-0a04a80d9f3caeffce4d7daddf5730034602073d.zip |
Replace another inet_ntop() call with getnameinfo().
Diffstat (limited to 'socket.c')
-rw-r--r-- | socket.c | 9 |
1 files changed, 4 insertions, 5 deletions
@@ -300,9 +300,8 @@ int open_socket_out(char *host, int port, const char *bind_addr, if (DEBUG_GTE(CONNECT, 2)) { char buf[2048]; if ((error = getnameinfo(res->ai_addr, res->ai_addrlen, buf, sizeof buf, NULL, 0, NI_NUMERICHOST) != 0)) - rprintf(FINFO, "error in getnameinfo: %s\n", gai_strerror(error)); - else - rprintf(FINFO, "Connected to %s (%s)\n", h, buf); + snprintf(buf, sizeof buf, "*getnameinfo failure: %s*", gai_strerror(error)); + rprintf(FINFO, "Connected to %s (%s)\n", h, buf); } break; } @@ -312,8 +311,8 @@ int open_socket_out(char *host, int port, const char *bind_addr, for (res = res0, j = 0; res; res = res->ai_next, j++) { if (errnos[j] == 0) continue; - if (inet_ntop(res->ai_family, res->ai_addr->sa_data + 2, buf, sizeof buf) == NULL) - strlcpy(buf, "*inet_ntop failed*", sizeof buf); + if ((error = getnameinfo(res->ai_addr, res->ai_addrlen, buf, sizeof buf, NULL, 0, NI_NUMERICHOST) != 0)) + snprintf(buf, sizeof buf, "*getnameinfo failure: %s*", gai_strerror(error)); rsyserr(FERROR, errnos[j], "failed to connect to %s (%s)", h, buf); } if (s < 0) |