VirtualBox

Changeset 38129 in vbox


Ignore:
Timestamp:
Jul 25, 2011 8:22:44 AM (13 years ago)
Author:
vboxsync
Message:

VBoxService/VMInfo-win: Keep old user count when out of memory and warn about it.

File:
1 edited

Legend:

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

    r38087 r38129  
    319319#endif
    320320    Assert(RT_FAILURE(rc) || cUsersInList == 0 || (pszUserList && *pszUserList));
     321
     322    /* If the user enumeration above failed, reset the user count to 0 except
     323     * we didn't have enough memory anymore. In that case we want to preserve
     324     * the previous user count in order to not confuse third party tools which
     325     * rely on that count. */
    321326    if (RT_FAILURE(rc))
    322         cUsersInList = 0;
     327    {
     328        if (rc == VERR_NO_MEMORY)
     329        {
     330            static int s_iVMInfoBitchedOOM = 0;
     331            if (s_iVMInfoBitchedOOM++ < 3)
     332                VBoxServiceVerbose(0, "VMInfo/Users: Warning: Not enough memory available to enumerate users! Keeping old value (%u)\n",
     333                                   g_cVMInfoLoggedInUsers);
     334            cUsersInList = g_cVMInfoLoggedInUsers;
     335        }
     336        else
     337            cUsersInList = 0;
     338    }
    323339
    324340    VBoxServiceVerbose(4, "VMInfo/Users: cUsersInList: %u, pszUserList: %s, rc=%Rrc\n",
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