Changeset 103429 in vbox
- Timestamp:
- Feb 19, 2024 11:59:36 AM (9 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-server/linux/PerformanceLinux.cpp
r103285 r103429 49 49 #include "Performance.h" 50 50 51 #define VBOXVOLINFO_ NAME "VBoxVolInfo"51 #define VBOXVOLINFO_EXE_NAME "VBoxVolInfo" 52 52 53 53 namespace pm { … … 524 524 void CollectorLinux::addVolumeDependencies(const char *pcszVolume, DiskList& listDisks) 525 525 { 526 /** @todo r=bird: This is presumptive and will misbehave if someone puts VBox 527 * in directory which path contains spaces or other problematic 528 * characters. This is one of the reasons to avoid popen(). */ 529 static const char s_szSlashExeNameSpace[] = "/" VBOXVOLINFO_EXE_NAME " "; 530 size_t const cchVolume = strlen(pcszVolume); 526 531 char szVolInfo[RTPATH_MAX]; 527 int vrc = RTPathAppPrivateArch(szVolInfo, sizeof(szVolInfo) - sizeof( "/" VBOXVOLINFO_NAME " ") - strlen(pcszVolume));532 int vrc = RTPathAppPrivateArch(szVolInfo, sizeof(szVolInfo) - sizeof(s_szSlashExeNameSpace) - cchVolume); 528 533 if (RT_FAILURE(vrc)) 529 534 { 530 535 LogRel(("VolInfo: Failed to get program path, vrc=%Rrc\n", vrc)); 536 /** @todo r=bird: inconsistent failure behaviour. if popen fails, volume is 537 * pushed onto the list, while here it isn't. */ 531 538 return; 532 539 } 533 vrc = RTStrCat(szVolInfo, sizeof(szVolInfo), "/" VBOXVOLINFO_NAME " "); 534 AssertRCReturnVoid(vrc); 535 vrc = RTStrCat(szVolInfo, sizeof(szVolInfo), pcszVolume); 536 AssertRCReturnVoid(vrc); 540 memcpy(mempcpy(strchr(szVolInfo, '\0'), s_szSlashExeNameSpace, sizeof(s_szSlashExeNameSpace) - 1), 541 pcszVolume, cchVolume + 1); 537 542 538 543 FILE *fp = popen(szVolInfo, "r");
Note:
See TracChangeset
for help on using the changeset viewer.