chroot support in package kit: style fixes
- Catching an exception in the normal flow is not a good thing, instead, test before calling the function (I've been doing too much python lately) - Avoid using uninitialized nodeRef if there is no system root and also no specified root in the message. Thanks to Ingo or the code review.
This commit is contained in:
@@ -110,11 +110,13 @@ BPackageManager::Init(uint32 flags)
|
|||||||
// well. But we can easily filter those out.
|
// well. But we can easily filter those out.
|
||||||
_AddInstalledRepository(fSystemRepository);
|
_AddInstalledRepository(fSystemRepository);
|
||||||
|
|
||||||
try {
|
|
||||||
if (!fSystemRepository->IsInstalled())
|
if (!fSystemRepository->IsInstalled())
|
||||||
|
{
|
||||||
|
// Only add the home repository if the directory exists
|
||||||
|
BPath path;
|
||||||
|
status_t error = find_directory(B_USER_PACKAGES_DIRECTORY, &path);
|
||||||
|
if (error == B_OK && BEntry(path.Path()).Exists())
|
||||||
_AddInstalledRepository(fHomeRepository);
|
_AddInstalledRepository(fHomeRepository);
|
||||||
} catch(BFatalErrorException& exception) {
|
|
||||||
// No home repository found. This is ok for haikuporter chroots.
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -93,8 +93,9 @@ PackageDaemon::MessageReceived(BMessage* message)
|
|||||||
|
|
||||||
if (fSystemRoot != NULL && (error != B_OK
|
if (fSystemRoot != NULL && (error != B_OK
|
||||||
|| fSystemRoot->NodeRef() == nodeRef))
|
|| fSystemRoot->NodeRef() == nodeRef))
|
||||||
|
{
|
||||||
fSystemRoot->HandleRequest(DetachCurrentMessage());
|
fSystemRoot->HandleRequest(DetachCurrentMessage());
|
||||||
else {
|
} else if (error == B_OK) {
|
||||||
Root* root = _FindRoot(nodeRef);
|
Root* root = _FindRoot(nodeRef);
|
||||||
if (root != NULL) {
|
if (root != NULL) {
|
||||||
root->HandleRequest(DetachCurrentMessage());
|
root->HandleRequest(DetachCurrentMessage());
|
||||||
|
|||||||
Reference in New Issue
Block a user