VirtualBox

Changeset 94716 in vbox for trunk/src


Ignore:
Timestamp:
Apr 27, 2022 8:27:17 AM (3 years ago)
Author:
vboxsync
Message:

Main/Update check: Fixes for UpdateAgent::i_reportError(). bugref:7983

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/src-server/UpdateAgentImpl.cpp

    r94713 r94716  
    723723
    724724/**
    725  * Reports an error by setting the error info and also information subscribed listeners.
     725 * Reports an error by setting the error info and also informs subscribed listeners.
    726726 *
    727727 * @returns HRESULT
     
    732732HRESULT UpdateAgent::i_reportError(int vrc, const char *pcszMsgFmt, ...)
    733733{
     734    AssertReturn(pcszMsgFmt && *pcszMsgFmt != '\0', E_INVALIDARG);
     735
    734736    va_list va;
    735737    va_start(va, pcszMsgFmt);
    736738
    737     char *psz = NULL;
    738     if (RTStrAPrintfV(&psz, pcszMsgFmt, va) <= 0)
    739      return E_OUTOFMEMORY;
    740 
    741     LogRel(("Update agent (%s): %s\n", mData.m_strName.c_str(), psz));
    742 
    743     ::FireUpdateAgentErrorEvent(m_EventSource, psz, vrc);
    744 
    745     HRESULT const rc = setErrorVrc(VERR_COM_IPRT_ERROR /** @todo Translate HTTP errors to COM? */, psz);
     739    Utf8Str strMsg;
     740    HRESULT const rc = strMsg.printfVNoThrow(pcszMsgFmt, va);
     741    if (FAILED(rc))
     742    {
     743        va_end(va);
     744        return rc;
     745    }
    746746
    747747    va_end(va);
    748     RTStrFree(psz);
    749 
    750     return rc;
     748
     749    LogRel(("Update agent (%s): %s\n", mData.m_strName.c_str(), strMsg.c_str()));
     750
     751    ::FireUpdateAgentErrorEvent(m_EventSource, strMsg.c_str(), vrc);
     752
     753    return setErrorBoth(VERR_COM_IPRT_ERROR, vrc, strMsg.c_str());
    751754}
    752755
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