From aef4ee829aa6318ce812ae8fad7425c21dd4220c Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Sun, 25 May 2025 17:38:49 -0400 Subject: [PATCH] libext2fs: fix ext2fs_link() for EXT2FS_LINK_APPEND and non-regular files Fix the incorrect flag being passed to ext2fs_process_dir_block(). This bug was masked because EXT2_FT_REG_FILE has the same code point as DIRENT_FLAG_INCLUDE_EMPTY which was the flag that was needed and mke2fs -d was only use ext2fs_lik() for regular files. Fixes: 53aa6c54224f ("libext2fs: add the EXT2FS_LINK_APPEND flag ...) Signed-off-by: Theodore Ts'o --- lib/ext2fs/link.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ext2fs/link.c b/lib/ext2fs/link.c index 0d9b1837..a617d0af 100644 --- a/lib/ext2fs/link.c +++ b/lib/ext2fs/link.c @@ -647,7 +647,7 @@ retry: return retval; ctx.dir = dir; - ctx.flags = flags; + ctx.flags = DIRENT_FLAG_INCLUDE_EMPTY; ctx.func = link_proc; ctx.priv_data = &ls; ctx.errcode = 0; -- 2.47.2