diff options
author | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2023-04-29 02:56:26 +0200 |
---|---|---|
committer | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2023-04-29 23:44:05 +0200 |
commit | f21fa23162d294b1327aaa3528444c1aaceb5b5a (patch) | |
tree | 79d723a2da8c751c589fe899f252969f24a6247c /lib/util/src | |
parent | e976555d39b3361a061b33f59108b5cb75f71a62 (diff) |
Move dir entry remapping from gensquashfs to libutil
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'lib/util/src')
-rw-r--r-- | lib/util/src/dir_tree_iterator.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/lib/util/src/dir_tree_iterator.c b/lib/util/src/dir_tree_iterator.c index 775039d..55fbabb 100644 --- a/lib/util/src/dir_tree_iterator.c +++ b/lib/util/src/dir_tree_iterator.c @@ -120,6 +120,23 @@ static dir_entry_t *expand_path(const dir_tree_iterator_t *it, dir_entry_t *ent) return ent; } +static void apply_changes(const dir_tree_iterator_t *it, dir_entry_t *ent) +{ + if (!(it->cfg.flags & DIR_SCAN_KEEP_TIME)) + ent->mtime = it->cfg.def_mtime; + + if (!(it->cfg.flags & DIR_SCAN_KEEP_UID)) + ent->uid = it->cfg.def_uid; + + if (!(it->cfg.flags & DIR_SCAN_KEEP_GID)) + ent->gid = it->cfg.def_gid; + + if (!(it->cfg.flags & DIR_SCAN_KEEP_MODE)) { + ent->mode &= ~(07777); + ent->mode |= it->cfg.def_mode & 07777; + } +} + /*****************************************************************************/ static void destroy(sqfs_object_t *obj) @@ -176,8 +193,7 @@ retry: return it->state; } - if (!(it->cfg.flags & DIR_SCAN_KEEP_TIME)) - ent->mtime = it->cfg.def_mtime; + apply_changes(it, ent); if (S_ISDIR(ent->mode)) { if (!(it->cfg.flags & DIR_SCAN_NO_RECURSION)) { |