1
0
Fork 0
mirror of https://repo.or.cz/socat.git synced 2025-07-19 09:22:57 +00:00

AIX: Fixed configure and compile issues

This commit is contained in:
Gerhard Rieger 2022-01-02 13:08:29 +01:00
parent ffa09eac00
commit 967e2b24b5
6 changed files with 47 additions and 8 deletions

View file

@ -212,7 +212,7 @@ int sockname(int fd, FILE *outfile, char style) {
struct protoent protoent, *protoentp;
#endif
#define PROTONAMEMAX 1024
char protoname[PROTONAMEMAX];
char protoname[PROTONAMEMAX] = "";
#if defined(SO_PROTOCOL) || defined(SO_PROTOTYPE)
int proto;
#endif
@ -263,6 +263,15 @@ int sockname(int fd, FILE *outfile, char style) {
#elif HAVE_GETPROTOBYNUMBER_R==2 /* Solaris */
protoentp = getprotobynumber(proto);
strncpy(protoname, protoentp->p_name, sizeof(protoname));
#elif HAVE_GETPROTOBYNUMBER_R==3 /* AIX */
{
struct protoent_data proto_data;
rc = getprotobynumber_r(proto, &protoent, &proto_data);
if (rc == 0) {
strncpy(protoname, protoent.p_name, sizeof(protoname));
endprotoent_r(&proto_data);
}
}
#else
switch (proto) {
case IPPROTO_TCP: strcpy(protoname, "tcp"); break;