VirtualBox

Ignore:
Timestamp:
Jan 24, 2023 1:40:47 PM (2 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
155492
Message:

Main/iokit.cpp: DarwinSubscribeUSBNotifications was missing a return code check in the last IOServiceAddMatchingNotification call. shouldn't break anything, but you know... rc->hrc/vrc/krc. bugref:10223

File:
1 edited

Legend:

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

    r98103 r98287  
    126126        /* Get the darwin version we are running on. */
    127127        char szVersion[64];
    128         int rc = RTSystemQueryOSInfo(RTSYSOSINFO_RELEASE, &szVersion[0], sizeof(szVersion));
    129         if (RT_SUCCESS(rc))
    130         {
    131             rc = RTStrToUInt32Ex(&szVersion[0], NULL, 10, &g_uMajorDarwin);
    132             AssertLogRelMsg(rc == VINF_SUCCESS || rc == VWRN_TRAILING_CHARS,
     128        int vrc = RTSystemQueryOSInfo(RTSYSOSINFO_RELEASE, &szVersion[0], sizeof(szVersion));
     129        if (RT_SUCCESS(vrc))
     130        {
     131            vrc = RTStrToUInt32Ex(&szVersion[0], NULL, 10, &g_uMajorDarwin);
     132            AssertLogRelMsg(vrc == VINF_SUCCESS || vrc == VWRN_TRAILING_CHARS,
    133133                            ("Failed to convert the major part of the version string '%s' into an integer: %Rrc\n",
    134                              szVersion, rc));
     134                             szVersion, vrc));
    135135        }
    136136        else
    137             AssertLogRelMsgFailed(("Failed to query the OS release version with %Rrc\n", rc));
     137            AssertLogRelMsgFailed(("Failed to query the OS release version with %Rrc\n", vrc));
    138138    }
    139139    return true;
     
    659659             * Create the notification callbacks.
    660660             */
    661             kern_return_t rc = IOServiceAddMatchingNotification(pNotify->NotifyPort,
    662                                                                 kIOPublishNotification,
    663                                                                 IOServiceMatching(kIOUSBDeviceClassName),
    664                                                                 darwinUSBAttachNotification1,
    665                                                                 pNotify,
    666                                                                 &pNotify->AttachIterator);
    667             if (rc == KERN_SUCCESS)
     661            kern_return_t krc = IOServiceAddMatchingNotification(pNotify->NotifyPort,
     662                                                                 kIOPublishNotification,
     663                                                                 IOServiceMatching(kIOUSBDeviceClassName),
     664                                                                 darwinUSBAttachNotification1,
     665                                                                 pNotify,
     666                                                                 &pNotify->AttachIterator);
     667            if (krc == KERN_SUCCESS)
    668668            {
    669669                darwinDrainIterator(pNotify->AttachIterator);
    670                 rc = IOServiceAddMatchingNotification(pNotify->NotifyPort,
    671                                                       kIOMatchedNotification,
    672                                                       IOServiceMatching(kIOUSBDeviceClassName),
    673                                                       darwinUSBAttachNotification2,
    674                                                       pNotify,
    675                                                       &pNotify->AttachIterator2);
    676                 if (rc == KERN_SUCCESS)
     670                krc = IOServiceAddMatchingNotification(pNotify->NotifyPort,
     671                                                       kIOMatchedNotification,
     672                                                       IOServiceMatching(kIOUSBDeviceClassName),
     673                                                       darwinUSBAttachNotification2,
     674                                                       pNotify,
     675                                                       &pNotify->AttachIterator2);
     676                if (krc == KERN_SUCCESS)
    677677                {
    678678                    darwinDrainIterator(pNotify->AttachIterator2);
    679                     rc = IOServiceAddMatchingNotification(pNotify->NotifyPort,
    680                                                           kIOTerminatedNotification,
    681                                                           IOServiceMatching(kIOUSBDeviceClassName),
    682                                                           darwinUSBDetachNotification,
    683                                                           pNotify,
    684                                                           &pNotify->DetachIterator);
     679                    krc = IOServiceAddMatchingNotification(pNotify->NotifyPort,
     680                                                           kIOTerminatedNotification,
     681                                                           IOServiceMatching(kIOUSBDeviceClassName),
     682                                                           darwinUSBDetachNotification,
     683                                                           pNotify,
     684                                                           &pNotify->DetachIterator);
     685                    if (krc == KERN_SUCCESS)
    685686                    {
    686687                        darwinDrainIterator(pNotify->DetachIterator);
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