Changeset 25412 in vbox for trunk/src/VBox/Main/HostImpl.cpp
- Timestamp:
- Dec 15, 2009 3:42:05 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/HostImpl.cpp
r25310 r25412 426 426 { 427 427 char *cdromEnv = strdup(RTEnvGet("VBOX_CDROM")); 428 char *saveStr = NULL; 428 429 char *cdromDrive; 429 cdromDrive = strtok (cdromEnv, ":"); /** @todo use strtok_r. */430 cdromDrive = strtok_r(cdromEnv, ":", &saveStr); 430 431 while (cdromDrive) 431 432 { … … 437 438 list.push_back(hostDVDDriveObj); 438 439 } 439 cdromDrive = strtok (NULL, ":");440 cdromDrive = strtok_r(NULL, ":", &saveStr); 440 441 } 441 442 free(cdromEnv); … … 2216 2217 while (getmntent(mntFile, &mntTab) == 0) 2217 2218 { 2218 char *mountName = strdup(mntTab.mnt_special); 2219 char *mountPoint = strdup(mntTab.mnt_mountp); 2220 char *mountFSType = strdup(mntTab.mnt_fstype); 2221 2222 // skip devices we are not interested in 2223 if ((*mountName && mountName[0] == '/') && // skip 'fake' devices (like -hosts, proc, fd, swap) 2224 (*mountFSType && (strcmp(mountFSType, "devfs") != 0 && // skip devfs (i.e. /devices) 2225 strcmp(mountFSType, "dev") != 0 && // skip dev (i.e. /dev) 2226 strcmp(mountFSType, "lofs") != 0)) && // skip loop-back file-system (lofs) 2227 (*mountPoint && strcmp(mountPoint, "/") != 0)) // skip point '/' (Can CD/DVD be mounted at '/' ???) 2219 const char *mountName = mntTab.mnt_special; 2220 const char *mountPoint = mntTab.mnt_mountp; 2221 const char *mountFSType = mntTab.mnt_fstype; 2222 if (mountName && mountPoint && mountFSType) 2228 2223 { 2229 char *rawDevName = getfullrawname(mountName); 2230 if (validateDevice(rawDevName, true)) 2224 // skip devices we are not interested in 2225 if ((*mountName && mountName[0] == '/') && // skip 'fake' devices (like -hosts, proc, fd, swap) 2226 (*mountFSType && (strncmp(mountFSType, "devfs", 5) != 0 && // skip devfs (i.e. /devices) 2227 strncmp(mountFSType, "dev", 3) != 0 && // skip dev (i.e. /dev) 2228 strncmp(mountFSType, "lofs", 4) != 0))) // skip loop-back file-system (lofs) 2231 2229 { 2232 ComObjPtr<Medium> hostDVDDriveObj; 2233 hostDVDDriveObj.createObject(); 2234 hostDVDDriveObj->init(m->pParent, DeviceType_DVD, Bstr(rawDevName)); 2235 list.push_back (hostDVDDriveObj); 2230 char *rawDevName = getfullrawname((char *)mountName); 2231 if (validateDevice(rawDevName, true)) 2232 { 2233 ComObjPtr<Medium> hostDVDDriveObj; 2234 hostDVDDriveObj.createObject(); 2235 hostDVDDriveObj->init(m->pParent, DeviceType_DVD, Bstr(rawDevName)); 2236 list.push_back (hostDVDDriveObj); 2237 } 2238 free(rawDevName); 2236 2239 } 2237 free(rawDevName);2238 2240 } 2239 2240 free(mountName);2241 free(mountPoint);2242 free(mountFSType);2243 2241 } 2244 2242
Note:
See TracChangeset
for help on using the changeset viewer.