From b94825c4d4371477a3a62cab42038d2a436897c9 Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Mon, 18 Sep 2023 23:38:13 +0200 Subject: libsqfs: Make sure directory iterators always set the size for links Signed-off-by: David Oberhollenzer --- lib/sqfs/src/io/dir_hl.c | 1 + lib/sqfs/src/io/dir_unix.c | 4 +--- 2 files changed, 2 insertions(+), 3 deletions(-) (limited to 'lib/sqfs/src') diff --git a/lib/sqfs/src/io/dir_hl.c b/lib/sqfs/src/io/dir_hl.c index 08efaaf..b693a49 100644 --- a/lib/sqfs/src/io/dir_hl.c +++ b/lib/sqfs/src/io/dir_hl.c @@ -134,6 +134,7 @@ static int next(sqfs_dir_iterator_t *base, sqfs_dir_entry_t **out) *out = NULL; } } else { + (*out)->size = strlen(it->link_target); (*out)->mode = SQFS_INODE_MODE_LNK | 0777; (*out)->flags |= SQFS_DIR_ENTRY_FLAG_HARD_LINK; } diff --git a/lib/sqfs/src/io/dir_unix.c b/lib/sqfs/src/io/dir_unix.c index efc9a2a..1cf7beb 100644 --- a/lib/sqfs/src/io/dir_unix.c +++ b/lib/sqfs/src/io/dir_unix.c @@ -115,9 +115,7 @@ static int dir_next(sqfs_dir_iterator_t *base, sqfs_dir_entry_t **out) (*out)->uid = it->sb.st_uid; (*out)->gid = it->sb.st_gid; (*out)->inode = it->sb.st_ino; - - if (S_ISREG(it->sb.st_mode)) - (*out)->size = it->sb.st_size; + (*out)->size = it->sb.st_size; if ((*out)->dev != it->device) (*out)->flags |= SQFS_DIR_ENTRY_FLAG_MOUNT_POINT; -- cgit v1.2.3