Changeset 2e8523b for lib/ftutil.c
- Timestamp:
- 2016-12-31T20:40:09Z (8 years ago)
- Branches:
- master
- Children:
- 188b75e, 8768f67
- Parents:
- 7801298
- git-author:
- Jelmer Vernooij <jelmer@…> (28-12-16 13:50:14)
- git-committer:
- dx <dx@…> (31-12-16 20:40:09)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
lib/ftutil.c
r7801298 r2e8523b 63 63 if (for_bitlbee_client) { 64 64 *scolon = '\0'; 65 strncpy(host, ftlisten, HOST_NAME_MAX);65 strncpy(host, ftlisten, NI_MAXHOST); 66 66 *scolon = ';'; 67 67 } else { 68 strncpy(host, scolon + 1, HOST_NAME_MAX);68 strncpy(host, scolon + 1, NI_MAXHOST); 69 69 } 70 70 } else { 71 strncpy(host, ftlisten, HOST_NAME_MAX);71 strncpy(host, ftlisten, NI_MAXHOST); 72 72 } 73 73 … … 78 78 } else if (copy_fd >= 0 && getsockname(copy_fd, (struct sockaddr*) &saddrs, &ssize) == 0 && 79 79 (saddrs.ss_family == AF_INET || saddrs.ss_family == AF_INET6) && 80 getnameinfo((struct sockaddr*) &saddrs, ssize, host, HOST_NAME_MAX,80 getnameinfo((struct sockaddr*) &saddrs, ssize, host, NI_MAXHOST, 81 81 NULL, 0, NI_NUMERICHOST) == 0) { 82 82 /* We just took our local address on copy_fd, which is likely to be a … … 84 84 most sensible we can get easily. */ 85 85 } else { 86 ASSERTSOCKOP(gethostname(host, HOST_NAME_MAX + 1), "gethostname()");86 ASSERTSOCKOP(gethostname(host, NI_MAXHOST), "gethostname()"); 87 87 } 88 88 … … 109 109 ( void * ) &(( struct sockaddr_in * ) saddr)->sin_addr.s_addr : 110 110 ( void * ) &(( struct sockaddr_in6 * ) saddr)->sin6_addr.s6_addr, 111 host, HOST_NAME_MAX)) {111 host, NI_MAXHOST)) { 112 112 strcpy(errmsg, "inet_ntop failed on listening socket"); 113 113 return -1; … … 128 128 129 129 /* I hate static-length strings.. */ 130 host[ HOST_NAME_MAX- 1] = '\0';130 host[NI_MAXHOST - 1] = '\0'; 131 131 port[5] = '\0'; 132 132
Note: See TracChangeset
for help on using the changeset viewer.