qom: do not return root for empty path An empty path will return the sole object of that type in the QOM tree. This is different from "/", which returns the root. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Message-id: 1366303444-24620-7-git-send-email-pbonzini@redhat.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
diff --git a/qom/object.c b/qom/object.c index 093502e..dd53d24 100644 --- a/qom/object.c +++ b/qom/object.c
@@ -1113,21 +1113,13 @@ Object *object_resolve_path_type(const char *path, const char *typename, bool *ambiguous) { - bool partial_path = true; Object *obj; gchar **parts; parts = g_strsplit(path, "/", 0); - if (parts == NULL || parts[0] == NULL) { - g_strfreev(parts); - return object_get_root(); - } + assert(parts); - if (strcmp(parts[0], "") == 0) { - partial_path = false; - } - - if (partial_path) { + if (parts[0] == NULL || strcmp(parts[0], "") != 0) { if (ambiguous) { *ambiguous = false; }