AIX: Fixed runtime issues

This commit is contained in:
Gerhard Rieger 2022-01-02 21:34:10 +01:00
parent 967e2b24b5
commit e1a2e37480
4 changed files with 20 additions and 12 deletions

View file

@ -15,6 +15,12 @@ Porting:
Adapted include requirements for IPv6 Adapted include requirements for IPv6
Guarded MSG_DONTWAIT Guarded MSG_DONTWAIT
Continued porting Socat to AIX-7.1 - Fixed some runtime errors:
UNIX domain sockets of type SEQPACKET are not available.
Connecting to UNIX datagram socket fails with EPROTONOSUPPORT (vs.
EPROTOTYPE on most other OSes).
Streams: Must not push ldterm when it is already active (hangs).
####################### V 1.7.4.2: ####################### V 1.7.4.2:
Corrections: Corrections:

View file

@ -89,7 +89,7 @@ static int xioopen_gopen(int argc, const char *argv[], struct opt *opts, int xio
if ((result = _xioopen_open(filename, openflags, opts)) < 0) if ((result = _xioopen_open(filename, openflags, opts)) < 0)
return result; return result;
#ifdef I_PUSH #ifdef I_PUSH
if (S_ISCHR(st_mode)) { if (S_ISCHR(st_mode) && Ioctl(result, I_FIND, "ldterm\0") == 0) {
Ioctl(result, I_PUSH, "ptem\0\0\0"); /* pad string length ... */ Ioctl(result, I_PUSH, "ptem\0\0\0"); /* pad string length ... */
Ioctl(result, I_PUSH, "ldterm\0"); /* ... to requirements of ... */ Ioctl(result, I_PUSH, "ldterm\0"); /* ... to requirements of ... */
Ioctl(result, I_PUSH, "ttcompat"); /* ... AdressSanitizer */ Ioctl(result, I_PUSH, "ttcompat"); /* ... AdressSanitizer */

View file

@ -2219,8 +2219,10 @@ xiosocket(struct opt *opts, int pf, int socktype, int proto, int msglevel) {
retropt_int(opts, OPT_SO_PROTOTYPE, &proto); retropt_int(opts, OPT_SO_PROTOTYPE, &proto);
result = Socket(pf, socktype, proto); result = Socket(pf, socktype, proto);
if (result < 0) { if (result < 0) {
int _errno = errno;
Msg4(msglevel, "socket(%d, %d, %d): %s", Msg4(msglevel, "socket(%d, %d, %d): %s",
pf, socktype, proto, strerror(errno)); pf, socktype, proto, strerror(errno));
errno = _errno;
return -1; return -1;
} }
return result; return result;

View file

@ -576,11 +576,11 @@ _xioopen_unix_client(xiosingle_t *xfd, int xioflags, unsigned groups,
/* xfd->dtype = DATA_STREAM; // is default */ /* xfd->dtype = DATA_STREAM; // is default */
/* this function handles AF_UNIX with EPROTOTYPE specially for us */ /* this function handles AF_UNIX with EPROTOTYPE specially for us */
if ((result = if ((result =
xioopen_connect(xfd, _xioopen_connect(xfd,
needbind?&us:NULL, uslen, needbind?&us:NULL, uslen,
&them.soa, themlen, &them.soa, themlen,
opts, pf, socktype?socktype:SOCK_STREAM, protocol, opts, pf, socktype?socktype:SOCK_STREAM, protocol,
false)) == 0) false, E_INFO)) == 0)
break; break;
if (errno != EPROTOTYPE || socktype != 0) if (errno != EPROTOTYPE || socktype != 0)
break; break;
@ -590,13 +590,13 @@ _xioopen_unix_client(xiosingle_t *xfd, int xioflags, unsigned groups,
socktype = SOCK_SEQPACKET; socktype = SOCK_SEQPACKET;
if ((result = if ((result =
xioopen_connect(xfd, _xioopen_connect(xfd,
needbind?&us:NULL, uslen, needbind?&us:NULL, uslen,
(struct sockaddr *)&them, themlen, (struct sockaddr *)&them, themlen,
opts, pf, SOCK_SEQPACKET, protocol, opts, pf, SOCK_SEQPACKET, protocol,
false)) == 0) false, E_INFO)) == 0)
break; break;
if (errno != EPROTOTYPE) if (errno != EPROTOTYPE && errno != EPROTONOSUPPORT/*AIX*/)
break; break;
if (needbind) if (needbind)
Unlink(us.un.sun_path); Unlink(us.un.sun_path);