VirtualBox

Changeset 91042 in vbox


Ignore:
Timestamp:
Aug 31, 2021 6:34:40 PM (3 years ago)
Author:
vboxsync
Message:

Audio/Validation Kit: Got rid of the embedded (and probably wrong) failure reply struct and replaced it with ATSPKTREPFAIL so that clients also can interpret it more easily. ​bugref:10008

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Audio/AudioTestServiceClient.cpp

    r91040 r91042  
    165165        else if (RTStrNCmp(Reply.szOp, "FAILED  ", ATSPKT_OPCODE_MAX_LEN) == 0)
    166166        {
     167            LogRelFunc(("Received error from server (cbPayload=%zu)\n", Reply.cbPayload));
     168
    167169            if (Reply.cbPayload)
    168170            {
    169                 if (Reply.cbPayload == sizeof(ATSPKTREPFAIL))
     171                if (   Reply.cbPayload >=  sizeof(int) /* At least the rc must be present. */
     172                    && Reply.cbPayload <= sizeof(ATSPKTREPFAIL) - sizeof(ATSPKTHDR))
    170173                {
    171                     PATSPKTREPFAIL pRep = (PATSPKTREPFAIL)Reply.pvPayload;
     174                    rc = *(int *)Reply.pvPayload; /* Reach error code back to caller. */
     175
     176                    const char *pcszMsg = (char *)Reply.pvPayload + sizeof(int);
    172177                    /** @todo Check NULL termination of pcszMsg? */
    173178
    174                     LogRelFunc(("Received error: %s (%Rrc)\n", pRep->ach, pRep->rc));
    175 
    176                     rc = pRep->rc; /* Reach error code back to caller. */
     179                    LogRelFunc(("Error message: %s (%Rrc)\n", pcszMsg, rc));
    177180                }
    178181                else
     
    192195    }
    193196
     197    LogRelFlowFuncLeaveRC(rc);
    194198    return rc;
    195199}
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette