X-Git-Url: https://wimlib.net/git/?p=wimlib;a=blobdiff_plain;f=src%2Fdentry.c;h=927b3da9baa1a80628e72d3da5ee2ef6cb548fa2;hp=ee33d1240a5a066c7b6ae28de4965c275a6fa8e5;hb=29a09c1a5c20e1b04cc11ef24f5863bf8db7796c;hpb=7231431086332de22b2556477bcc5fc2c3e4bdcf diff --git a/src/dentry.c b/src/dentry.c index ee33d124..927b3da9 100644 --- a/src/dentry.c +++ b/src/dentry.c @@ -424,21 +424,22 @@ struct dentry *get_dentry_child_with_name(const struct dentry *dentry, static struct dentry *get_dentry_relative_path(struct dentry *cur_dir, const char *path) { - struct dentry *child; + struct dentry *child, *children; size_t base_len; const char *new_path; if (*path == '\0') return cur_dir; - child = cur_dir->d_inode->children; - if (child) { + children = cur_dir->d_inode->children; + if (children) { new_path = path_next_part(path, &base_len); + child = children; do { if (dentry_has_name(child, path, base_len)) return get_dentry_relative_path(child, new_path); child = child->next; - } while (child != cur_dir->d_inode->children); + } while (child != children); } return NULL; }