Changeset 35237 in vbox
- Timestamp:
- Dec 20, 2010 11:11:38 AM (14 years ago)
- Location:
- trunk/src/VBox/Main
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/ExtPackManagerImpl.cpp
r35218 r35237 2055 2055 } 2056 2056 2057 /** 2058 * Finds the success indicator string in the stderr output ofr hte helper app. 2059 * 2060 * @returns Pointer to the indicator. 2061 * @param psz The stderr output string. Can be NULL. 2062 * @param cch The size of the string. 2063 */ 2064 static char *findSuccessIndicator(char *psz, size_t cch) 2065 { 2066 static const char s_szSuccessInd[] = "rcExit=RTEXITCODE_SUCCESS"; 2067 Assert(!cch || strlen(psz) == cch); 2068 if (cch < sizeof(s_szSuccessInd) - 1) 2069 return NULL; 2070 char *pszInd = &psz[cch - sizeof(s_szSuccessInd) + 1]; 2071 if (strcmp(s_szSuccessInd, pszInd)) 2072 return NULL; 2073 return pszInd; 2074 } 2057 2075 2058 2076 /** … … 2209 2227 } 2210 2228 2211 if ( offStdErrBuf > 02212 && !strcmp(pszStdErrBuf, "rcExit=RTEXITCODE_SUCCESS"))2213 { 2214 *pszS tdErrBuf= '\0';2215 offStdErrBuf = 0;2229 char *pszSuccessInd = findSuccessIndicator(pszStdErrBuf, offStdErrBuf); 2230 if (pszSuccessInd) 2231 { 2232 *pszSuccessInd = '\0'; 2233 offStdErrBuf = pszSuccessInd - pszStdErrBuf; 2216 2234 } 2217 2235 else if ( ProcStatus.enmReason == RTPROCEXITREASON_NORMAL 2218 2236 && ProcStatus.iStatus == 0) 2219 ProcStatus.iStatus = 666;2237 ProcStatus.iStatus = offStdErrBuf ? 667 : 666; 2220 2238 2221 2239 /* … … 2223 2241 */ 2224 2242 if ( ProcStatus.enmReason == RTPROCEXITREASON_NORMAL 2225 && ProcStatus.iStatus == 0 2226 && offStdErrBuf == 0) 2243 && ProcStatus.iStatus == 0) 2227 2244 hrc = S_OK; 2228 2245 else if (ProcStatus.enmReason == RTPROCEXITREASON_NORMAL) -
trunk/src/VBox/Main/VBoxExtPackHelperApp.cpp
r35236 r35237 1335 1335 bool fHaveDisplayVar = RTEnvExist("DISPLAY"); 1336 1336 int iSuArg = cSuArgs; 1337 PRTHANDLE pStdNull = NULL;1338 RTHANDLE StdNull;1339 1337 char szExecTool[260]; 1340 1338 char szXterm[260]; … … 1345 1343 if (fHaveDisplayVar && FindExecTool(szExecTool, sizeof(szExecTool), "kdesudo")) 1346 1344 { 1347 rc = RTFileOpenBitBucket(&StdNull.u.hFile, RTFILE_O_WRITE); 1348 if (RT_SUCCESS(rc)) 1349 { 1350 StdNull.enmType = RTHANDLETYPE_FILE; 1351 pStdNull = &StdNull; 1352 1353 iSuArg = cSuArgs - 4; 1354 papszArgs[cSuArgs - 4] = szExecTool; 1355 papszArgs[cSuArgs - 3] = "--comment"; 1356 papszArgs[cSuArgs - 2] = iCmd == CMD_INSTALL 1357 ? "VirtualBox extension pack installer" 1358 : iCmd == CMD_UNINSTALL 1359 ? "VirtualBox extension pack uninstaller" 1360 : "VirtualBox extension pack maintainer"; 1361 papszArgs[cSuArgs - 1] = "--"; 1362 } 1363 else 1364 RTMsgError("Failed to open /dev/null: %Rrc"); 1345 iSuArg = cSuArgs - 4; 1346 papszArgs[cSuArgs - 4] = szExecTool; 1347 papszArgs[cSuArgs - 3] = "--comment"; 1348 papszArgs[cSuArgs - 2] = iCmd == CMD_INSTALL 1349 ? "VirtualBox extension pack installer" 1350 : iCmd == CMD_UNINSTALL 1351 ? "VirtualBox extension pack uninstaller" 1352 : "VirtualBox extension pack maintainer"; 1353 papszArgs[cSuArgs - 1] = "--"; 1365 1354 } 1366 1355 /* 1367 1356 * gksu is our favorite as it is very well integrated. 1368 *1369 * gksu is chatty, so we need to send stderr and stdout to /dev/null or the1370 * error detection logic in Main will fail. This is a bit unfortunate as1371 * error messages gets lost, but wtf.1372 1357 */ 1373 1358 else if (fHaveDisplayVar && FindExecTool(szExecTool, sizeof(szExecTool), "gksu")) 1374 1359 { 1375 rc = RTFileOpenBitBucket(&StdNull.u.hFile, RTFILE_O_WRITE);1376 if (RT_SUCCESS(rc))1377 {1378 StdNull.enmType = RTHANDLETYPE_FILE;1379 pStdNull = &StdNull;1380 1381 1360 #if 0 /* older gksu does not grok --description nor '--' and multiple args. */ 1382 1383 1384 1385 1386 1387 1388 1389 1390 1361 iSuArg = cSuArgs - 4; 1362 papszArgs[cSuArgs - 4] = szExecTool; 1363 papszArgs[cSuArgs - 3] = "--description"; 1364 papszArgs[cSuArgs - 2] = iCmd == CMD_INSTALL 1365 ? "VirtualBox extension pack installer" 1366 : iCmd == CMD_UNINSTALL 1367 ? "VirtualBox extension pack uninstaller" 1368 : "VirtualBox extension pack maintainer"; 1369 papszArgs[cSuArgs - 1] = "--"; 1391 1370 #else 1392 1393 1394 1395 1371 iSuArg = cSuArgs - 2; 1372 papszArgs[cSuArgs - 2] = szExecTool; 1373 papszArgs[cSuArgs - 1] = pszCmdLine; 1374 papszArgs[cSuArgs] = NULL; 1396 1375 #endif 1397 }1398 else1399 RTMsgError("Failed to open /dev/null: %Rrc");1400 1376 } 1401 1377 /* … … 1447 1423 RTPROCESS hProcess; 1448 1424 rc = RTProcCreateEx(papszArgs[iSuArg], &papszArgs[iSuArg], RTENV_DEFAULT, 0 /*fFlags*/, 1449 NULL /*phStdIn*/, pStdNull, pStdNull, NULL /*pszAsUser*/,NULL /*pszPassword*/,1425 NULL /*phStdIn*/, NULL /*phStdOut*/, NULL /*phStdErr*/, NULL /*pszAsUser*/, NULL /*pszPassword*/, 1450 1426 &hProcess); 1451 1427 if (RT_SUCCESS(rc)) … … 1467 1443 } 1468 1444 RTStrFree(pszCmdLine); 1469 RTFileClose(StdNull.u.hFile);1470 1445 1471 1446 #endif
Note:
See TracChangeset
for help on using the changeset viewer.