Run NTFS tests when --without-ntfs-3g
[wimlib] / src / dentry.c
index ee33d1240a5a066c7b6ae28de4965c275a6fa8e5..927b3da9baa1a80628e72d3da5ee2ef6cb548fa2 100644 (file)
@@ -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;
 }