sandbox/fs: Make linking of nodes in os_dirent_ls more obvious
authorStefan Brüns <stefan.bruens@rwth-aachen.de>
Sat, 1 Oct 2016 18:41:39 +0000 (20:41 +0200)
committerSimon Glass <sjg@chromium.org>
Tue, 11 Oct 2016 16:17:07 +0000 (10:17 -0600)
Previously, after reading/creating the second dirent, the second entry
would be chained to the first entry and the first entry would be linked
to head. Instead, immediately link the first entry to head.

Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
Acked-by: Simon Glass <sjg@chromium.org>
arch/sandbox/cpu/os.c

index 2d63dd8..c71882a 100644 (file)
@@ -363,8 +363,8 @@ int os_dirent_ls(const char *dirname, struct os_dirent_node **headp)
                        next->size = buf.st_size;
                if (node)
                        node->next = next;
-               if (!head)
-                       head = node;
+               else
+                       head = next;
        }
        *headp = head;