From eb6621081a6d0f094d58c30e6850f3e01c88402e Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Tue, 9 Feb 2016 20:21:23 +0900 Subject: [PATCH] server: Avoid redundant open call when looking for an object type. Signed-off-by: Alexandre Julliard --- server/directory.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/server/directory.c b/server/directory.c index 312a8456f48..67d80893b03 100644 --- a/server/directory.c +++ b/server/directory.c @@ -269,13 +269,13 @@ struct object_type *get_object_type( const struct unicode_str *name ) { struct object_type *type; - if ((type = open_object_dir( dir_objtype, name, 0, &object_type_ops ))) - return type; - - if ((type = create_named_object_dir( dir_objtype, name, 0, &object_type_ops ))) + if ((type = create_named_object_dir( dir_objtype, name, OBJ_OPENIF, &object_type_ops ))) { - grab_object( type ); - make_object_static( &type->obj ); + if (get_error() != STATUS_OBJECT_NAME_EXISTS) + { + grab_object( type ); + make_object_static( &type->obj ); + } clear_error(); } return type; -- 2.11.4.GIT