VirtualBox

Changeset 44045 in vbox for trunk/src/VBox/Additions/common


Ignore:
Timestamp:
Dec 6, 2012 8:19:53 AM (12 years ago)
Author:
vboxsync
Message:

VBoxServiceControlExecGetOutput: Shut up a gcc maybe warning and fixed something it forgot to warn about regarding pRequest.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/common/VBoxService/VBoxServiceControl.cpp

    r43259 r44045  
    440440 * @param   uPID                    PID of process to retrieve the output from.
    441441 * @param   uHandleId               Stream ID (stdout = 0, stderr = 2) to get the output from.
    442  * @param   uTimeout                Timeout (in ms) to wait for output becoming available.
     442 * @param   cMsTimeout              Timeout (in ms) to wait for output becoming
     443 *                                  available.
    443444 * @param   pvBuf                   Pointer to a pre-allocated buffer to store the output.
    444445 * @param   cbBuf                   Size (in bytes) of the pre-allocated buffer.
     
    446447 */
    447448int VBoxServiceControlExecGetOutput(uint32_t uPID, uint32_t uCID,
    448                                     uint32_t uHandleId, uint32_t uTimeout,
     449                                    uint32_t uHandleId, uint32_t cMsTimeout,
    449450                                    void *pvBuf, uint32_t cbBuf, uint32_t *pcbRead)
    450451{
    451452    AssertPtrReturn(pvBuf, VERR_INVALID_POINTER);
    452453    AssertReturn(cbBuf, VERR_INVALID_PARAMETER);
    453     /* pcbRead is optional. */
    454 
    455     int rc = VINF_SUCCESS;
    456     VBOXSERVICECTRLREQUESTTYPE reqType;
     454    AssertPtrNullReturn(pcbRead, VERR_INVALID_POINTER);
     455
     456    int                         rc      = VINF_SUCCESS;
     457    VBOXSERVICECTRLREQUESTTYPE  reqType = VBOXSERVICECTRLREQUEST_UNKNOWN; /* (gcc maybe, well, wrong.) */
    457458    switch (uHandleId)
    458459    {
     
    471472    }
    472473
    473     PVBOXSERVICECTRLREQUEST pRequest;
    474     if (RT_SUCCESS(rc))
    475     {
    476         rc = VBoxServiceControlThreadRequestAllocEx(&pRequest, reqType,
    477                                                     pvBuf, cbBuf, uCID);
    478         if (RT_SUCCESS(rc))
     474    if (RT_SUCCESS(rc))
     475    {
     476        PVBOXSERVICECTRLREQUEST pRequest;
     477        rc = VBoxServiceControlThreadRequestAllocEx(&pRequest, reqType, pvBuf, cbBuf, uCID);
     478        if (RT_SUCCESS(rc))
     479        {
    479480            rc = VBoxServiceControlThreadPerform(uPID, pRequest);
    480 
    481         if (RT_SUCCESS(rc))
    482         {
    483             if (pcbRead)
     481            if (RT_SUCCESS(rc) && pcbRead)
    484482                *pcbRead = pRequest->cbData;
    485         }
    486 
    487         VBoxServiceControlThreadRequestFree(pRequest);
     483            VBoxServiceControlThreadRequestFree(pRequest);
     484        }
    488485    }
    489486
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