- Timestamp:
- Feb 19, 2024 7:12:34 AM (12 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxManage/VBoxManageMisc.cpp
r102540 r103411 77 77 { 78 78 HRESULT hrc; 79 const char *VMName = NULL; 80 81 Bstr bstrVMName; 82 Bstr bstrPasswordFile; 79 80 const char *pszVmFile = NULL; 81 const char *pszPasswordFile = NULL; 83 82 84 83 int c; … … 93 92 { 94 93 case 'p': // --password 95 bstrPasswordFile = ValueUnion.psz;94 pszPasswordFile = ValueUnion.psz; 96 95 break; 97 96 98 97 case VINF_GETOPT_NOT_OPTION: 99 if ( bstrVMName.isEmpty())100 VMName = ValueUnion.psz;98 if (!pszVmFile) 99 pszVmFile = ValueUnion.psz; 101 100 else 102 101 return errorSyntax(Misc::tr("Invalid parameter '%s'"), ValueUnion.psz); … … 120 119 Utf8Str strPassword; 121 120 122 if ( bstrPasswordFile.isNotEmpty())123 { 124 if ( bstrPasswordFile == "-")121 if (pszPasswordFile) 122 { 123 if (pszPasswordFile[0] == '-' && pszPasswordFile[1] == '\0') 125 124 { 126 125 /* Get password from console. */ … … 131 130 else 132 131 { 133 RTEXITCODE rcExit = readPasswordFile( a->argv[3], &strPassword);132 RTEXITCODE rcExit = readPasswordFile(pszPasswordFile, &strPassword); 134 133 if (rcExit == RTEXITCODE_FAILURE) 135 134 return RTMsgErrorExitFailure(Misc::tr("Failed to read password from file")); … … 141 140 * and the client's interpretation of relative paths. Remove after the API 142 141 * has been redesigned. */ 143 hrc = a->virtualBox->OpenMachine(Bstr( a->argv[0]).raw(),142 hrc = a->virtualBox->OpenMachine(Bstr(pszVmFile).raw(), 144 143 Bstr(strPassword).raw(), 145 144 machine.asOutParam()); 146 if (FAILED(hrc) && !RTPathStartsWithRoot( a->argv[0]))145 if (FAILED(hrc) && !RTPathStartsWithRoot(pszVmFile)) 147 146 { 148 147 char szVMFileAbs[RTPATH_MAX] = ""; 149 int vrc = RTPathAbs( a->argv[0], szVMFileAbs, sizeof(szVMFileAbs));148 int vrc = RTPathAbs(pszVmFile, szVMFileAbs, sizeof(szVMFileAbs)); 150 149 if (RT_FAILURE(vrc)) 151 150 return RTMsgErrorExitFailure(Misc::tr("Failed to convert \"%s\" to an absolute path: %Rrc"), 152 a->argv[0], vrc);151 pszVmFile, vrc); 153 152 CHECK_ERROR(a->virtualBox, OpenMachine(Bstr(szVMFileAbs).raw(), 154 153 Bstr(strPassword).raw(),
Note:
See TracChangeset
for help on using the changeset viewer.