find_object_index() sets the status code to STATUS_NO_MORE_ENTRIES to indicate that the given index does not exist in the list of the directory entries, in addition to returning NULL.
STATUS_NO_MORE_ENTRIES only makes sense in the context of the function's only caller, req_get_directory_entry(), which is used to implement the NtQueryDirectoryObject() system call, specifically the single object case. Otherwise, the choice of status code is unintuitive.
Remove the set_error() call in find_object_index(), and move the responsibility of setting the status code to the caller.
Signed-off-by: Jinoh Kang jinoh.kang.kr@gmail.com ---
Notes: v3 -> v4: new patch
server/directory.c | 1 + server/object.c | 1 - 2 files changed, 1 insertion(+), 1 deletion(-)
diff --git a/server/directory.c b/server/directory.c index 23d7eb0a2b7..fdcfe9bef21 100644 --- a/server/directory.c +++ b/server/directory.c @@ -562,6 +562,7 @@ DECL_HANDLER(get_directory_entry)
release_object( obj ); } + else set_error( STATUS_NO_MORE_ENTRIES ); release_object( dir ); } } diff --git a/server/object.c b/server/object.c index 907bc087444..84c8e70e6a2 100644 --- a/server/object.c +++ b/server/object.c @@ -485,7 +485,6 @@ struct object *find_object_index( const struct namespace *namespace, unsigned in if (!index--) return grab_object( ptr->obj ); } } - set_error( STATUS_NO_MORE_ENTRIES ); return NULL; }