VirtualBox

Ignore:
Timestamp:
Oct 2, 2008 9:22:56 PM (17 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
37389
Message:

suplibOsInit/linux: use local hDevice like the rest of the gang.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostDrivers/Support/linux/SUPLib-linux.cpp

    r12908 r12961  
    8282    if (fPreInited)
    8383        return VINF_SUCCESS;
     84    Assert(pThis->hDevice == NIL_RTFILE);
    8485
    8586    /*
     
    9596     * Try open the device.
    9697     */
    97     pThis->hDevice = open(DEVICE_NAME, O_RDWR, 0);
    98     if ((int)pThis->hDevice < 0)
     98    int hDevice = open(DEVICE_NAME, O_RDWR, 0);
     99    if (hDevice < 0)
    99100    {
    100101        /*
    101102         * Try load the device.
    102103         */
    103         pThis->hDevice = open(DEVICE_NAME, O_RDWR, 0);
    104         if ((int)pThis->hDevice < 0)
     104        hDevice = open(DEVICE_NAME, O_RDWR, 0);
     105        if (hDevice < 0)
    105106        {
    106107            int rc;
     
    122123     * Mark the file handle close on exec.
    123124     */
    124     if (fcntl(pThis->hDevice, F_SETFD, FD_CLOEXEC) == -1)
    125     {
    126         close(pThis->hDevice);
    127         pThis->hDevice = -1;
     125    if (fcntl(hDevice, F_SETFD, FD_CLOEXEC) == -1)
     126    {
     127        close(hDevice);
    128128#ifdef IN_SUP_HARDENED_R3
    129129        return VERR_INTERNAL_ERROR;
     
    136136     * We're done.
    137137     */
     138    pThis->hDevice = hDevice;
    138139    return VINF_SUCCESS;
    139140}
     
    145146{
    146147    /*
    147      * Check if we're initited at all.
    148      */
    149     if ((int)pThis->hDevice >= 0)
     148     * Close the device if it's actually open.
     149     */
     150    if (pThis->hDevice != NIL_RTFILE)
    150151    {
    151152        if (close(pThis->hDevice))
    152153            AssertFailed();
    153         pThis->hDevice = -1;
     154        pThis->hDevice = NIL_RTFILE;
    154155    }
    155156
Note: See TracChangeset for help on using the changeset viewer.

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