package daemon: Volume::InitPackages(): Fix error case
Don't assign fListener, when starting node monitoring fails.
This commit is contained in:
@@ -174,7 +174,9 @@ Volume::InitPackages(Listener* listener)
|
|||||||
// node-monitor the volume's packages directory
|
// node-monitor the volume's packages directory
|
||||||
status_t error = watch_node(&fPackagesDirectoryRef, B_WATCH_DIRECTORY,
|
status_t error = watch_node(&fPackagesDirectoryRef, B_WATCH_DIRECTORY,
|
||||||
BMessenger(this));
|
BMessenger(this));
|
||||||
if (error != B_OK) {
|
if (error == B_OK) {
|
||||||
|
fListener = listener;
|
||||||
|
} else {
|
||||||
ERROR("Volume::InitPackages(): failed to start watching the packages "
|
ERROR("Volume::InitPackages(): failed to start watching the packages "
|
||||||
"directory of the volume at \"%s\": %s\n",
|
"directory of the volume at \"%s\": %s\n",
|
||||||
fPath.String(), strerror(error));
|
fPath.String(), strerror(error));
|
||||||
@@ -182,8 +184,6 @@ Volume::InitPackages(Listener* listener)
|
|||||||
// packages directory won't work correctly.
|
// packages directory won't work correctly.
|
||||||
}
|
}
|
||||||
|
|
||||||
fListener = listener;
|
|
||||||
|
|
||||||
// read the packages directory and get the active packages
|
// read the packages directory and get the active packages
|
||||||
int fd = OpenRootDirectory();
|
int fd = OpenRootDirectory();
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
|
|||||||
Reference in New Issue
Block a user