From a075bf746427810c4aab2be5d3852b10ce5dc3f1 Mon Sep 17 00:00:00 2001 From: Eric Biggers Date: Sat, 21 Jan 2023 12:32:19 -0800 Subject: [PATCH] misc/create_inode: fix -Wunused-variable warnings in __populate_fs() These showed up when building for Windows. Signed-off-by: Eric Biggers Signed-off-by: Theodore Ts'o --- misc/create_inode.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/misc/create_inode.c b/misc/create_inode.c index d7ab1c2..f4a3653 100644 --- a/misc/create_inode.c +++ b/misc/create_inode.c @@ -815,11 +815,9 @@ static errcode_t __populate_fs(ext2_filsys fs, ext2_ino_t parent_ino, const char *name; struct dirent **dent; struct stat st; - char *ln_target = NULL; unsigned int save_inode; ext2_ino_t ino; errcode_t retval = 0; - int read_cnt; int hdlink; size_t cur_dir_path_len; int i, num_dents; @@ -902,7 +900,10 @@ static errcode_t __populate_fs(ext2_filsys fs, ext2_ino_t parent_ino, goto out; } break; - case S_IFLNK: + case S_IFLNK: { + char *ln_target; + int read_cnt; + ln_target = malloc(st.st_size + 1); if (ln_target == NULL) { com_err(__func__, retval, @@ -937,7 +938,8 @@ static errcode_t __populate_fs(ext2_filsys fs, ext2_ino_t parent_ino, goto out; } break; -#endif + } +#endif /* !_WIN32 */ case S_IFREG: retval = do_write_internal(fs, parent_ino, name, name, root); -- 1.8.3.1