user-supplied callback, once for the current directory before calling
ftw_dir, in case that part of the hierarchy should be pruned.
`func' does that by setting `data->skip'.
result = add_object (&data, &st);
if (result == 0)
- result = ftw_dir (&data, &st);
+ {
+ /* If we're doing a depth-first traversal, give the user
+ a chance to prune the top-level directory. */
+ if ((flags & FTW_DEPTH)
+ && (result = (*data.func) (data.dirbuf, &st, FTW_DPRE,
+ &data.ftw)) == 0
+ && ! data.ftw.skip)
+ result = ftw_dir (&data, &st);
+ }
}
else
{