fixed error return in _Scan() function. now only returns B_OK when a device was found.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19716 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Marcus Overhagen 2007-01-06 01:04:09 +00:00
parent 2a3ed81cf6
commit 6c3245f6a7

View File

@ -1131,7 +1131,7 @@ status_t
KDiskDeviceManager::_Scan(const char *path) KDiskDeviceManager::_Scan(const char *path)
{ {
DBG(OUT("KDiskDeviceManager::_Scan(%s)\n", path)); DBG(OUT("KDiskDeviceManager::_Scan(%s)\n", path));
status_t error = B_OK; status_t error = B_ENTRY_NOT_FOUND;
struct stat st; struct stat st;
if (lstat(path, &st) < 0) { if (lstat(path, &st) < 0) {
return errno; return errno;
@ -1150,7 +1150,8 @@ DBG(OUT("KDiskDeviceManager::_Scan(%s)\n", path));
|| entryPath.Append(entry->d_name) != B_OK) { || entryPath.Append(entry->d_name) != B_OK) {
continue; continue;
} }
_Scan(entryPath.Path()); if (_Scan(entryPath.Path()) == B_OK)
error = B_OK;
} }
closedir(dir); closedir(dir);
} else { } else {
@ -1166,7 +1167,7 @@ DBG(OUT(" found device: %s\n", path));
if (!device) if (!device)
return B_NO_MEMORY; return B_NO_MEMORY;
// init the KDiskDevice // init the KDiskDevice
status_t error = device->SetTo(path); error = device->SetTo(path);
// add the device // add the device
if (error == B_OK && !_AddDevice(device)) if (error == B_OK && !_AddDevice(device))
error = B_NO_MEMORY; error = B_NO_MEMORY;