When parsing a path with a leading slash, the root inode was freed which lead to a crash. Path parsing is now improved and allows leading slashs like other
filesystem commands (e.g. ext4load).

Signed-off-by: Stefan Agner <ste...@agner.ch>
---
 fs/btrfs/btrfs.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/btrfs/btrfs.c b/fs/btrfs/btrfs.c
index a7fcc16..e4dfd67 100644
--- a/fs/btrfs/btrfs.c
+++ b/fs/btrfs/btrfs.c
@@ -963,6 +963,9 @@ int searchdir(const char *name)
        if (!pathbuf)
                goto err;

+       while (*p == '/')
+               p++;
+
        do {
 got_link:
                if (*p == '/') {
@@ -1324,9 +1327,6 @@ int btrfs_ls(const char *dirn)
        char *dirname = (char *)dirn;
        struct _DIR_ *dir;

-       if (*dirname == '/' && *(dirname+1) == 0)
-               *dirname = '.';
-
        dir = opendir(dirname);
        if (dir == NULL)
                return -1;
--
1.8.3.1



_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Reply via email to