VirtualBox

Ignore:
Timestamp:
Nov 12, 2007 10:32:04 AM (17 years ago)
Author:
vboxsync
Message:

r=bird

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Network/DrvTAP.cpp

    r5698 r5701  
    170170
    171171/*******************************************************************************
    172 *   Internal Functions & Globals                                               *
     172*   Internal Functions                                                         *
    173173*******************************************************************************/
    174174#ifdef RT_OS_SOLARIS
     
    325325            size_t cbRead = 0;
    326326#ifdef VBOX_WITH_CROSSBOW
    327             rc = VINF_SUCCESS;
    328327            cbRead = sizeof(achBuf);
    329             int rc2 = dlpi_recv(pData->pDeviceHandle, NULL, NULL, achBuf, &cbRead, -1, NULL);
    330             if (rc2 != DLPI_SUCCESS)
    331                 rc = SolarisDLPIErr2VBoxErr(rc2);
     328            rc = dlpi_recv(pData->pDeviceHandle, NULL, NULL, achBuf, &cbRead, -1, NULL);
     329            rc = RT_LIKELY(rc == DLPI_SUCCESS) ? VINF_SUCCESS : SolarisDLPIErr2VBoxErr(rc);
    332330#else
    333331            rc = RTFileRead(pData->FileDevice, achBuf, sizeof(achBuf), &cbRead);
     
    465463                size_t      cbRead = 0;
    466464#ifdef VBOX_WITH_CROSSBOW
    467                 int rc = VINF_SUCCESS;
    468465                cbRead = sizeof(achBuf);
    469                 int rc2 = dlpi_recv(pData->pDeviceHandle, NULL, NULL, achBuf, &cbRead, -1, NULL);
    470                 if (rc2 != DLPI_SUCCESS)
    471                     rc = SolarisDLPIErr2VBoxErr(rc2);
     466                int rc = dlpi_recv(pData->pDeviceHandle, NULL, NULL, achBuf, &cbRead, -1, NULL);
     467                rc = RT_LIKELY(rc == DLPI_SUCCESS) ? VINF_SUCCESS : SolarisDLPIErr2VBoxErr(rc);
    472468#else
    473469                int rc = RTFileRead(pData->FileDevice, achBuf, RT_MIN(sizeof(achBuf), cbMax), &cbRead);
     
    527523        if (RT_SUCCESS(rc))
    528524        {
    529             if (Status.iStatus == 0 && Status.enmReason == RTPROCEXITREASON_NORMAL)
     525            if (    Status.iStatus == 0
     526                &&  Status.enmReason == RTPROCEXITREASON_NORMAL)
    530527                return VINF_SUCCESS;
    531            
     528
    532529            LogRel(("TAP#%d: Error running TAP setup application: %s\n", pData->pDrvIns->iInstance, pData->pszSetupApplication));
    533             return VERR_HOSTIF_INIT_FAILED;
    534530        }
    535531        else
    536         {
    537532            LogRel(("TAP#%d: RTProcWait failed for: %s\n", pData->pDrvIns->iInstance, pData->pszSetupApplication));
    538             return VERR_HOSTIF_INIT_FAILED;
    539         }
    540533    }
    541534    else
     
    545538              pData->pszSetupApplication, strerror(errno)));
    546539    }
    547    
    548     return VERR_HOSTIF_INIT_FAILED;   
     540
     541    return VERR_HOSTIF_INIT_FAILED;
    549542}
    550543
     
    572565        if (RT_SUCCESS(rc))
    573566        {
    574             if (Status.iStatus == 0 && Status.enmReason == RTPROCEXITREASON_NORMAL)
     567            if (    Status.iStatus == 0
     568                &&  Status.enmReason == RTPROCEXITREASON_NORMAL)
    575569                return VINF_SUCCESS;
    576            
     570
    577571            LogRel(("TAP#%d: Error running TAP terminate application: %s\n", pData->pDrvIns->iInstance, pData->pszTerminateApplication));
    578             return VERR_HOSTIF_TERM_FAILED;
    579572        }
    580573        else
    581         {
    582574            LogRel(("TAP#%d: RTProcWait failed for: %s\n", pData->pDrvIns->iInstance, pData->pszTerminateApplication));
    583             return VERR_HOSTIF_INIT_FAILED;
    584         }
    585575    }
    586576    else
     
    590580              pData->pszTerminateApplication, strerror(errno)));
    591581    }
    592     return VERR_HOSTIF_TERM_FAILED;   
     582    return VERR_HOSTIF_TERM_FAILED;
    593583}
    594584
     
    659649        return PDMDrvHlpVMSetError(pData->pDrvIns, VERR_HOSTIF_INIT_FAILED, RT_SRC_POS,
    660650                           N_("dladm_vnic_create() failed. NIC %s probably incorrect."), szNICName);
    661    
     651
    662652    pData->pszDeviceNameActual = NULL;
    663653    RTStrAPrintf(&pData->pszDeviceNameActual, "vnic%u", VnicID);
     
    742732                rc = VERR_HOSTIF_INIT_FAILED;
    743733            }
    744             free(pBuf);
     734            RTMemFree(pBuf);
    745735        }
    746736        else
     
    855845        case DLPI_EINHANDLE:        return VERR_INVALID_HANDLE;
    856846        case DLPI_ETIMEDOUT:        return VERR_TIMEOUT;
    857         case DLPI_FAILURE:          return VERR_GENERAL_FAILURE;       
     847        case DLPI_FAILURE:          return VERR_GENERAL_FAILURE;
    858848
    859849        case DLPI_EVERNOTSUP:
     
    871861    }
    872862
    873     AssertMsgFailed(("SolarisDLPIErr2VBoxErr: Unhandled error %d\n", rc));   
     863    AssertMsgFailed(("SolarisDLPIErr2VBoxErr: Unhandled error %d\n", rc));
    874864    return VERR_UNRESOLVED_ERROR;
    875865}
     
    11191109
    11201110#ifdef RT_OS_SOLARIS
     1111    /** @todo r=bird: This *does* need checking against ConsoleImpl2.cpp if used on non-solaris systems. */
    11211112    if (pData->FileDevice != NIL_RTFILE)
    11221113    {
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