comms: Quick-fix a crash in ZM::Socket::Accept

mLocalAddr is always nullptr and not used anywhere. So just use a local variable for
the time being.
The comms types will need an API rework since the current one is rather convoluted.
Postpone fixing this properly until then.
pull/3211/head
Peter Keresztes Schmidt 2021-04-10 18:15:12 +02:00
parent 25e6b70381
commit 3d2614b429
1 changed files with 4 additions and 4 deletions

View File

@ -269,11 +269,11 @@ bool ZM::Socket::listen() {
}
bool ZM::Socket::accept() {
sockaddr *rem_addr = mLocalAddr->getTempAddr();
sockaddr rem_addr = {};
socklen_t rem_addr_size = getAddrSize();
int newSd = -1;
if ((newSd = ::accept(mSd, rem_addr, &rem_addr_size)) == -1) {
if ((newSd = ::accept(mSd, &rem_addr, &rem_addr_size)) == -1) {
Error("accept(), errno = %d, error = %s", errno, strerror(errno));
close();
return false;
@ -287,11 +287,11 @@ bool ZM::Socket::accept() {
}
bool ZM::Socket::accept(int &newSd) {
sockaddr *rem_addr = mLocalAddr->getTempAddr();
sockaddr rem_addr = {};
socklen_t rem_addr_size = getAddrSize();
newSd = -1;
if ((newSd = ::accept(mSd, rem_addr, &rem_addr_size)) == -1) {
if ((newSd = ::accept(mSd, &rem_addr, &rem_addr_size)) == -1) {
Error("accept(), errno = %d, error = %s", errno, strerror(errno));
close();
return false;