1 |
commit: 1b42d9bd178a8fddf8e31615ac37ce3bb9d94d16 |
2 |
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sat Jun 27 09:34:49 2020 +0000 |
4 |
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org> |
5 |
CommitDate: Sat Jun 27 09:34:49 2020 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=1b42d9bd |
7 |
|
8 |
libq/tree: ensure tree_foreach_pkg_fast can be run multiple times too |
9 |
|
10 |
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org> |
11 |
|
12 |
libq/tree.c | 2 ++ |
13 |
1 file changed, 2 insertions(+) |
14 |
|
15 |
diff --git a/libq/tree.c b/libq/tree.c |
16 |
index ad8db47..e41a0cb 100644 |
17 |
--- a/libq/tree.c |
18 |
+++ b/libq/tree.c |
19 |
@@ -1477,6 +1477,8 @@ tree_foreach_pkg(tree_ctx *ctx, tree_pkg_cb callback, void *priv, |
20 |
/* allow foreach to be called again on the same open tree */ |
21 |
if (ctx->do_sort) |
22 |
scandir_free(ctx->cat_de, ctx->cat_cnt); |
23 |
+ else |
24 |
+ rewinddir(ctx->dir); |
25 |
ctx->cat_de = NULL; |
26 |
ctx->cat_cur = 0; |
27 |
ctx->cat_cnt = 0; |