diff options
author | Rob Landley <rob@landley.net> | 2007-02-04 19:14:58 -0500 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2007-02-04 19:14:58 -0500 |
commit | 720fc26d33352407715cb286a4edc23d15906d5f (patch) | |
tree | f0f621317e0e2ffc895b7b814488d0bc12fd11ed /lib/lib.c | |
parent | 97c63ecb359138a04073e043b85bf928a14d7e8a (diff) | |
download | toybox-720fc26d33352407715cb286a4edc23d15906d5f.tar.gz |
Add parent pointer to dirtree, more work on mke2fs (populate dirtree, count
index blocks).
Diffstat (limited to 'lib/lib.c')
-rw-r--r-- | lib/lib.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -534,7 +534,7 @@ struct dirtree *read_dirtree_node(char *path) // Given a directory (in a writeable PATH_MAX buffer), recursively read in a // directory tree. -struct dirtree *read_dirtree(char *path) +struct dirtree *read_dirtree(char *path, struct dirtree *parent) { struct dirtree *dt = NULL, **ddt = &dt; DIR *dir; @@ -554,7 +554,8 @@ struct dirtree *read_dirtree(char *path) snprintf(path+len, sizeof(toybuf)-len, "/%s", entry->d_name); *ddt = read_dirtree_node(path); - if (entry->d_type == DT_DIR) (*ddt)->child = read_dirtree(path); + (*ddt)->parent = parent; + if (entry->d_type == DT_DIR) (*ddt)->child = read_dirtree(path, *ddt); ddt = &((*ddt)->next); path[len]=0; } |