packagefs/daemon: Ignore packages/ entries without .hpkg suffix
This commit is contained in:
@@ -807,6 +807,13 @@ Volume::_AddInitialPackages()
|
|||||||
if (strcmp(entry->d_name, ".") == 0 || strcmp(entry->d_name, "..") == 0)
|
if (strcmp(entry->d_name, ".") == 0 || strcmp(entry->d_name, "..") == 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
// also skip any entry without a ".hpkg" extension
|
||||||
|
size_t nameLength = strlen(entry->d_name);
|
||||||
|
if (nameLength < 5
|
||||||
|
|| memcmp(entry->d_name + nameLength - 5, ".hpkg", 5) != 0) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
Package* package;
|
Package* package;
|
||||||
if (_LoadPackage(entry->d_name, package) != B_OK)
|
if (_LoadPackage(entry->d_name, package) != B_OK)
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
@@ -26,6 +26,9 @@
|
|||||||
#include "DebugSupport.h"
|
#include "DebugSupport.h"
|
||||||
|
|
||||||
|
|
||||||
|
static const char* kPackageFileNameExtension = ".hpkg";
|
||||||
|
|
||||||
|
|
||||||
// #pragma mark - Listener
|
// #pragma mark - Listener
|
||||||
|
|
||||||
|
|
||||||
@@ -338,6 +341,10 @@ Volume::_QueueNodeMonitorEvent(const BString& name, bool wasCreated)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ignore entries that don't have the ".hpkg" extension
|
||||||
|
if (!name.EndsWith(kPackageFileNameExtension))
|
||||||
|
return;
|
||||||
|
|
||||||
NodeMonitorEvent* event
|
NodeMonitorEvent* event
|
||||||
= new(std::nothrow) NodeMonitorEvent(name, wasCreated);
|
= new(std::nothrow) NodeMonitorEvent(name, wasCreated);
|
||||||
if (event == NULL) {
|
if (event == NULL) {
|
||||||
@@ -497,6 +504,9 @@ Volume::_ReadPackagesDirectory()
|
|||||||
|
|
||||||
entry_ref entry;
|
entry_ref entry;
|
||||||
while (directory.GetNextRef(&entry) == B_OK) {
|
while (directory.GetNextRef(&entry) == B_OK) {
|
||||||
|
if (!BString(entry.name).EndsWith(kPackageFileNameExtension))
|
||||||
|
continue;
|
||||||
|
|
||||||
Package* package = new(std::nothrow) Package;
|
Package* package = new(std::nothrow) Package;
|
||||||
if (package == NULL)
|
if (package == NULL)
|
||||||
RETURN_ERROR(B_NO_MEMORY);
|
RETURN_ERROR(B_NO_MEMORY);
|
||||||
|
|||||||
Reference in New Issue
Block a user