OSDN Git Service

ext4_utils: skip symbolic links in basefs file
authorJin Qian <jinqian@google.com>
Mon, 28 Aug 2017 19:38:39 +0000 (12:38 -0700)
committerJin Qian <jinqian@google.com>
Mon, 28 Aug 2017 19:38:39 +0000 (12:38 -0700)
base_fs uses actual file size instead of size of symlink itself to
reserve data blocks. This caused extra data blocks to be reserved
and failed e2fsck.

Bug: 35262536
Change-Id: I0e9b0cc99a0f9a33596928b01468426fc2d34ab0

ext4_utils/make_ext4fs.c

index 58069f3..0151026 100644 (file)
@@ -628,6 +628,13 @@ static void extract_base_fs_allocations(const char *directory, const char *mount
                        int start_block, end_block;
                        u32 block_file_size;
                        u32 real_file_block_size;
+                       struct stat buf;
+
+                       if (lstat(real_file_name, &buf) == -1)
+                               critical_error(err_msg);
+
+                       if (!S_ISREG(buf.st_mode))
+                               continue;
 
                        real_file_fd = open(real_file_name, O_RDONLY);
                        if (real_file_fd == -1) {