Skip to content

Commit

Permalink
qom: do not return root for empty path
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
bonzini authored and Anthony Liguori committed Apr 29, 2013
1 parent 98af93f commit 2e1103f
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions qom/object.c
Expand Up @@ -1113,21 +1113,13 @@ static Object *object_resolve_partial_path(Object *parent,
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();
}

if (strcmp(parts[0], "") == 0) {
partial_path = false;
}
assert(parts);

if (partial_path) {
if (parts[0] == NULL || strcmp(parts[0], "") != 0) {
if (ambiguous) {
*ambiguous = false;
}
Expand Down

0 comments on commit 2e1103f

Please sign in to comment.