VirtualBox

Changeset 27874 in vbox


Ignore:
Timestamp:
Mar 31, 2010 10:08:31 AM (15 years ago)
Author:
vboxsync
Message:

Main/Machine: make the config file existence check override actually work. the settings code is very paranoid about doing the right job, so there must not be an existing config file when a new one is written the first time.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/MachineImpl.cpp

    r27858 r27874  
    354354               )
    355355            {
     356                if (RT_SUCCESS(vrc))
     357                    RTFileClose(f);
    356358                if (!aOverride)
    357359                {
     
    360362                                  mData->m_strConfigFileFull.raw());
    361363                }
    362                 if (RT_SUCCESS(vrc))
    363                     RTFileClose(f);
     364                else
     365                {
     366                    /* try to delete the config file, as otherwise the creation
     367                     * of a new settings file will fail. */
     368                    int vrc2 = RTFileDelete(mData->m_strConfigFileFull.c_str());
     369                    if (RT_FAILURE(vrc2))
     370                        rc = setError(VBOX_E_FILE_ERROR,
     371                                      tr("Could not delete the settings file '%s' (%Rrc)"),
     372                                      mData->m_strConfigFileFull.raw(), vrc2);
     373                }
    364374            }
    365375            else
     
    71027112 *
    71037113 *  @note Must be never called directly but only from #saveSettings().
    7104  *
    7105  *  @param aRenamed receives |true| if the name was changed and the settings
    7106  *                  file was renamed as a result, or |false| otherwise. The
    7107  *                  value makes sense only on success.
    7108  *  @param aNew     receives |true| if a virgin settings file was created.
    71097114 */
    71107115HRESULT Machine::prepareSaveSettings(bool *pfNeedsGlobalSaveSettings)
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