Module: wine Branch: master Commit: 2c2b1b1f141d814441130fccc291919a15d9dc15 URL: https://gitlab.winehq.org/wine/wine/-/commit/2c2b1b1f141d814441130fccc291919...
Author: Zebediah Figura zfigura@codeweavers.com Date: Sat Apr 16 11:26:19 2022 -0500
server: Don't set error in find_object_index if the object is not found.
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.
---
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 e521a7b38c9..8f72fd44f6d 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 89e541ffb6b..459ead5f3a5 100644 --- a/server/object.c +++ b/server/object.c @@ -495,7 +495,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; }