VirtualBox

Ignore:
Timestamp:
Jul 9, 2019 1:14:53 AM (5 years ago)
Author:
vboxsync
Message:

Dhcpd,Main/DHCPServerImpl: LeasesFilename should be plural everywhere. Moved default calc in dhcpd into the config class. bugref:9288

File:
1 edited

Legend:

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

    r79610 r79621  
    6666
    6767    char tempConfigFileName[RTPATH_MAX];
    68     com::Utf8Str strLeaseFilename;
     68    com::Utf8Str strLeasesFilename;
    6969    com::Utf8Str networkName;
    7070    com::Utf8Str trunkName;
     
    696696    m->trunkName   = aTrunkName;
    697697    m->trunkType   = aTrunkType;
    698     HRESULT hrc = i_calcLeaseFilename(aNetworkName);
     698    HRESULT hrc = i_calcLeasesFilename(aNetworkName);
    699699    if (FAILED(hrc))
    700700        return hrc;
     
    732732    pElmRoot->setAttribute("lowerIP", m->lowerIP);
    733733    pElmRoot->setAttribute("upperIP", m->upperIP);
    734     pElmRoot->setAttribute("leaseFilename", m->strLeaseFilename);
     734    pElmRoot->setAttribute("leasesFilename", m->strLeasesFilename);
    735735
    736736    /* Process global options */
     
    866866     */
    867867    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
    868     if (m->strLeaseFilename.isEmpty())
    869     {
    870         HRESULT hrc = i_calcLeaseFilename(m->networkName.isEmpty() ? mName : m->networkName);
     868    if (m->strLeasesFilename.isEmpty())
     869    {
     870        HRESULT hrc = i_calcLeasesFilename(m->networkName.isEmpty() ? mName : m->networkName);
    871871        if (FAILED(hrc))
    872872            return hrc;
     
    886886        {
    887887            xml::XmlFileParser parser;
    888             parser.read(m->strLeaseFilename.c_str(), doc);
     888            parser.read(m->strLeasesFilename.c_str(), doc);
    889889        }
    890890        catch (const xml::EIPRTFailure &e)
     
    912912            }
    913913            return setErrorBoth(VBOX_E_FILE_ERROR, vrc, "Reading '%s' failed: %Rrc - %s",
    914                                 m->strLeaseFilename.c_str(), vrc, e.what());
     914                                m->strLeasesFilename.c_str(), vrc, e.what());
    915915        }
    916916        catch (const RTCError &e)
    917917        {
    918918            if (e.what())
    919                 return setError(VBOX_E_FILE_ERROR, "Reading '%s' failed: %s", m->strLeaseFilename.c_str(), e.what());
    920             return setError(VBOX_E_FILE_ERROR, "Reading '%s' failed: RTCError", m->strLeaseFilename.c_str());
     919                return setError(VBOX_E_FILE_ERROR, "Reading '%s' failed: %s", m->strLeasesFilename.c_str(), e.what());
     920            return setError(VBOX_E_FILE_ERROR, "Reading '%s' failed: RTCError", m->strLeasesFilename.c_str());
    921921        }
    922922        catch (std::bad_alloc &)
     
    927927        {
    928928            AssertFailed();
    929             return setError(VBOX_E_FILE_ERROR, tr("Reading '%s' failed: Unexpected exception"), m->strLeaseFilename.c_str());
     929            return setError(VBOX_E_FILE_ERROR, tr("Reading '%s' failed: Unexpected exception"), m->strLeasesFilename.c_str());
    930930        }
    931931
     
    988988
    989989/**
    990  * Calculates and updates the value of strLeaseFilename given @a aNetwork.
     990 * Calculates and updates the value of strLeasesFilename given @a aNetwork.
    991991 */
    992 HRESULT DHCPServer::i_calcLeaseFilename(const com::Utf8Str &aNetwork)
     992HRESULT DHCPServer::i_calcLeasesFilename(const com::Utf8Str &aNetwork)
    993993{
    994994    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
    995995
    996996    /* The lease file must be the same as we used the last time, so careful when changing this code. */
    997     int vrc = m->strLeaseFilename.assignNoThrow(mVirtualBox->i_homeDir());
     997    int vrc = m->strLeasesFilename.assignNoThrow(mVirtualBox->i_homeDir());
    998998    if (RT_SUCCESS(vrc))
    999         vrc = RTPathAppendCxx(m->strLeaseFilename, aNetwork);
     999        vrc = RTPathAppendCxx(m->strLeasesFilename, aNetwork);
    10001000    if (RT_SUCCESS(vrc))
    1001         vrc = m->strLeaseFilename.appendNoThrow("-Dhcpd.leases");
     1001        vrc = m->strLeasesFilename.appendNoThrow("-Dhcpd.leases");
    10021002    if (RT_SUCCESS(vrc))
    10031003    {
    1004         RTPathPurgeFilename(RTPathFilename(m->strLeaseFilename.mutableRaw()), RTPATH_STR_F_STYLE_HOST);
    1005         m->strLeaseFilename.jolt();
     1004        RTPathPurgeFilename(RTPathFilename(m->strLeasesFilename.mutableRaw()), RTPATH_STR_F_STYLE_HOST);
     1005        m->strLeasesFilename.jolt();
    10061006        return S_OK;
    10071007    }
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