Changeset 19236 in vbox
- Timestamp:
- Apr 28, 2009 12:58:25 PM (16 years ago)
- Location:
- trunk/src/VBox/Main
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/MachineImpl.cpp
r19017 r19236 7562 7562 RTFILE_O_READWRITE | RTFILE_O_OPEN | 7563 7563 RTFILE_O_DENY_WRITE); 7564 if (RT_FAILURE (vrc)) 7565 { 7564 if (RT_FAILURE (vrc) && (vrc != VERR_FILE_NOT_FOUND)) 7565 { 7566 /* Open the associated config file only with read access. */ 7567 vrc = RTFileOpen (&mData->mHandleCfgFile, 7568 Utf8Str (mData->mConfigFileFull), 7569 RTFILE_O_READ | RTFILE_O_OPEN | 7570 RTFILE_O_DENY_NONE); 7571 if (RT_FAILURE (vrc)) 7572 { 7573 /* We even cannot open it in read mode, so there's seriously 7574 something wrong. */ 7575 rc = setError (E_FAIL, 7576 tr ("Could not even open settings file '%ls' in read mode (%Rrc)"), 7577 mData->mConfigFile.raw(), vrc); 7578 } 7579 else 7580 { 7581 mData->mConfigFileReadonly = TRUE; 7582 } 7583 } 7584 else 7585 { 7586 mData->mConfigFileReadonly = FALSE; 7587 } 7588 7589 if (RT_FAILURE(vrc)) 7590 { 7566 7591 mData->mHandleCfgFile = NIL_RTFILE; 7567 7568 rc = setError (VBOX_E_FILE_ERROR, 7569 tr ("Could not lock the settings file '%ls' (%Rrc)"), 7570 mData->mConfigFileFull.raw(), vrc); 7592 mData->mConfigFileReadonly = FALSE; 7571 7593 } 7572 7594 } … … 7595 7617 /** @todo flush the directory. */ 7596 7618 mData->mHandleCfgFile = NIL_RTFILE; 7619 mData->mConfigFileReadonly = FALSE; 7597 7620 } 7598 7621 -
trunk/src/VBox/Main/VirtualBoxImpl.cpp
r19017 r19236 4080 4080 Assert (!isConfigLocked()); 4081 4081 if (!isConfigLocked()) 4082 { 4083 /* open the associated config file*/4082 { 4083 /* Open the associated config file. */ 4084 4084 int vrc = RTFileOpen (&mData.mCfgFile.mHandle, 4085 Utf8Str (mData.mCfgFile.mName), 4086 RTFILE_O_READWRITE | RTFILE_O_OPEN | 4087 RTFILE_O_DENY_WRITE); 4088 if (RT_FAILURE (vrc)) 4089 { 4085 Utf8Str (mData.mCfgFile.mName), 4086 RTFILE_O_READWRITE | RTFILE_O_OPEN | 4087 RTFILE_O_DENY_WRITE); 4088 if (RT_FAILURE (vrc) && (vrc != VERR_FILE_NOT_FOUND)) 4089 { 4090 /* Open the associated config file only with read access. */ 4091 vrc = RTFileOpen (&mData.mCfgFile.mHandle, 4092 Utf8Str (mData.mCfgFile.mName), 4093 RTFILE_O_READ | RTFILE_O_OPEN | 4094 RTFILE_O_DENY_NONE); 4095 if (RT_FAILURE (vrc)) 4096 { 4097 /* We even cannot open it in read mode, so there's seriously 4098 something wrong. */ 4099 rc = setError (E_FAIL, 4100 tr ("Could not even open settings file '%ls' in read mode (%Rrc)"), 4101 mData.mCfgFile.mName.raw(), vrc); 4102 } 4103 else 4104 { 4105 mData.mCfgFile.mReadonly = TRUE; 4106 } 4107 } 4108 else 4109 { 4110 mData.mCfgFile.mReadonly = FALSE; 4111 } 4112 4113 if (RT_FAILURE(vrc)) 4114 { 4090 4115 mData.mCfgFile.mHandle = NIL_RTFILE; 4091 4092 /* 4093 * It is OK if the file is not found, it will be created by 4094 * init(). Otherwise return an error. 4095 */ 4096 if (vrc != VERR_FILE_NOT_FOUND) 4097 rc = setError (E_FAIL, 4098 tr ("Could not lock the settings file '%ls' (%Rrc)"), 4099 mData.mCfgFile.mName.raw(), vrc); 4116 mData.mCfgFile.mReadonly = FALSE; 4100 4117 } 4101 4118 … … 4103 4120 mData.mCfgFile.mName.raw(), mData.mCfgFile.mHandle, rc)); 4104 4121 } 4105 4106 4122 return rc; 4107 4123 } … … 4127 4143 /** @todo flush the directory too. */ 4128 4144 mData.mCfgFile.mHandle = NIL_RTFILE; 4145 mData.mCfgFile.mReadonly = FALSE; 4129 4146 LogFlowThisFunc (("\n")); 4130 4147 } -
trunk/src/VBox/Main/include/MachineImpl.h
r19134 r19236 152 152 BOOL mRegistered; 153 153 154 /** Flag indicating that the config file is read-only. */ 155 BOOL mConfigFileReadonly; 154 156 Bstr mConfigFile; 155 157 Bstr mConfigFileFull; -
trunk/src/VBox/Main/include/VirtualBoxImpl.h
r18177 r19236 422 422 const Bstr mName; 423 423 RTFILE mHandle; 424 /** Flag indicating that the config file is read-only. */ 425 BOOL mReadonly; 424 426 }; 425 427
Note:
See TracChangeset
for help on using the changeset viewer.