Skip to content

Commit

Permalink
composefs-from-json: skip empty dir components
Browse files Browse the repository at this point in the history
solves a problem where a path like "sys/" would cause to add a node
with an empty name.

Signed-off-by: Giuseppe Scrivano <[email protected]>
  • Loading branch information
giuseppe committed Jul 4, 2023
1 parent 58f326a commit 51e643d
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions tools/composefs-from-json.c
Original file line number Diff line number Diff line change
Expand Up @@ -566,6 +566,9 @@ static struct lcfs_node_s *get_or_add_node(const char *typ,
while ((it = strsep(&dpath, "/"))) {
struct lcfs_node_s *c;

if (it[0] == '\0')
continue;

c = lcfs_node_lookup_child(node, it);
if (c) {
node = c;
Expand Down

0 comments on commit 51e643d

Please sign in to comment.