diff options
author | Rob Landley <rob@landley.net> | 2008-05-12 00:52:27 -0500 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2008-05-12 00:52:27 -0500 |
commit | 988abb33a5c9d8023a8e1bd5535a75a16e5d9e46 (patch) | |
tree | e79fe82472c84fe3e6675650e49770c8c0e23733 /lib/dirtree.c | |
parent | e156d44eb2e9954d37ed0dfa326f263c3ed4c3d7 (diff) | |
download | toybox-988abb33a5c9d8023a8e1bd5535a75a16e5d9e46.tar.gz |
Update mdev to work around the newest sysfs api breakage in the 2.6.25 kernel.
(Yeah, I know sysfs hasn't actually got an API, but I like to pretend...)
Diffstat (limited to 'lib/dirtree.c')
-rw-r--r-- | lib/dirtree.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/dirtree.c b/lib/dirtree.c index 45ee139c..a695bb36 100644 --- a/lib/dirtree.c +++ b/lib/dirtree.c @@ -58,6 +58,7 @@ struct dirtree *dirtree_read(char *path, struct dirtree *parent, if (!(dir = opendir(path))) perror_msg("No %s", path); else for (;;) { + int norecurse = 0; struct dirent *entry = readdir(dir); if (!entry) { closedir(dir); @@ -74,8 +75,9 @@ struct dirtree *dirtree_read(char *path, struct dirtree *parent, *ddt = dirtree_add_node(path); if (!*ddt) continue; (*ddt)->parent = parent; - if (callback) callback(path, *ddt); - if (entry->d_type == DT_DIR) + (*ddt)->depth = parent ? parent->depth + 1 : 1; + if (callback) norecurse = callback(path, *ddt); + if (!norecurse && entry->d_type == DT_DIR) (*ddt)->child = dirtree_read(path, *ddt, callback); if (callback) free(*ddt); else ddt = &((*ddt)->next); |