diff options
-rw-r--r-- | bin/gensquashfs/src/sort_by_file.c | 10 | ||||
-rw-r--r-- | include/fstree.h | 2 |
2 files changed, 7 insertions, 5 deletions
diff --git a/bin/gensquashfs/src/sort_by_file.c b/bin/gensquashfs/src/sort_by_file.c index bc89c39..6a428ab 100644 --- a/bin/gensquashfs/src/sort_by_file.c +++ b/bin/gensquashfs/src/sort_by_file.c @@ -257,9 +257,11 @@ int fstree_sort_files(fstree_t *fs, istream_t *sortfile) file_info_t *it; for (it = fs->files; it != NULL; it = it->next) { + tree_node_t *node = container_of(it, tree_node_t, data.file); + it->priority = 0; it->flags = 0; - it->already_matched = false; + node->flags &= ~FLAG_FILE_ALREADY_MATCHED; } filename = istream_get_filename(sortfile); @@ -308,10 +310,10 @@ int fstree_sort_files(fstree_t *fs, istream_t *sortfile) tree_node_t *node; char *path; - if (it->already_matched) + node = container_of(it, tree_node_t, data.file); + if (node->flags & FLAG_FILE_ALREADY_MATCHED) continue; - node = container_of(it, tree_node_t, data.file); path = fstree_get_path(node); if (path == NULL) { fprintf(stderr, "%s: " PRI_SZ ": out-of-memory\n", @@ -344,7 +346,7 @@ int fstree_sort_files(fstree_t *fs, istream_t *sortfile) have_match = true; it->flags = flags; it->priority = priority; - it->already_matched = true; + node->flags |= FLAG_FILE_ALREADY_MATCHED; if (!do_glob) break; diff --git a/include/fstree.h b/include/fstree.h index 7f85be8..1a7ad30 100644 --- a/include/fstree.h +++ b/include/fstree.h @@ -31,6 +31,7 @@ typedef struct fstree_t fstree_t; enum { FLAG_DIR_CREATED_IMPLICITLY = 0x01, + FLAG_FILE_ALREADY_MATCHED = 0x02, }; /* Additional meta data stored in a tree_node_t for regular files. */ @@ -46,7 +47,6 @@ struct file_info_t { /* used by sort file processing */ sqfs_s64 priority; int flags; - bool already_matched; }; /* A node in a file system tree */ |