ufs2: Fix wrong lookup iteration
Passed size needs to be size of name buffer, not of length we compare to. Fix the value and remove now unused parameter. Change-Id: Idb69a0e78ba376751edf8b3df3635cd0af4c9460 Reviewed-on: https://review.haiku-os.org/c/haiku/+/6850 Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
This commit is contained in:
parent
a4845b5416
commit
de4f20d48d
@ -42,18 +42,19 @@ DirectoryIterator::InitCheck()
|
||||
|
||||
|
||||
status_t
|
||||
DirectoryIterator::Lookup(const char* name, size_t length, ino_t* _id)
|
||||
DirectoryIterator::Lookup(const char* name, ino_t* _id)
|
||||
{
|
||||
if (strcmp(name, ".") == 0) {
|
||||
*_id = fInode->ID();
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
char getname[B_FILE_NAME_LENGTH];
|
||||
char getname[B_FILE_NAME_LENGTH + 1];
|
||||
|
||||
status_t status;
|
||||
while(true) {
|
||||
status = GetNext(getname, &length, _id);
|
||||
size_t len = sizeof (getname) - 1;
|
||||
status = GetNext(getname, &len, _id);
|
||||
if (status != B_OK)
|
||||
return status;
|
||||
if (strcmp(getname, name) == 0)
|
||||
|
@ -42,8 +42,7 @@ public:
|
||||
~DirectoryIterator();
|
||||
|
||||
status_t InitCheck();
|
||||
status_t Lookup(const char* name, size_t length,
|
||||
ino_t* id);
|
||||
status_t Lookup(const char* name, ino_t* id);
|
||||
status_t GetNext(char* name, size_t* _nameLength,
|
||||
ino_t* _id);
|
||||
status_t _GetNext(const char* name, size_t* _nameLength,
|
||||
|
@ -214,8 +214,7 @@ ufs2_lookup(fs_volume *_volume, fs_vnode *_directory, const char *name,
|
||||
Volume* volume = (Volume*)_volume->private_volume;
|
||||
Inode* directory = (Inode*)_directory->private_node;
|
||||
|
||||
status_t status = DirectoryIterator(directory).Lookup(name, strlen(name),
|
||||
(ino_t*)_vnodeID);
|
||||
status_t status = DirectoryIterator(directory).Lookup(name, _vnodeID);
|
||||
|
||||
if (status != B_OK)
|
||||
return status;
|
||||
|
Loading…
x
Reference in New Issue
Block a user