Skip to content

Commit

Permalink
Dont replace holes in sparse files with non-0 bytes when creating fla…
Browse files Browse the repository at this point in the history
…sh images

Signed-off-by: Hudson Ayers <[email protected]>
  • Loading branch information
hudson-ayers-cruise committed Aug 31, 2023
1 parent fcf9480 commit 041ae74
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion util.c
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,12 @@ int insert_image(struct image *image, struct image *sub,
image_error(image, "open %s: %s", infile, strerror(errno));
goto out;
}
ret = map_file_extents(image, infile, in_fd, size, &extents, &extent_count);
if (byte == 0) {
ret = map_file_extents(image, infile, in_fd, size, &extents, &extent_count);
} else {
/* Don't want to fill holes with non-0 bytes */
ret = whole_file_exent(size, &extents, &extent_count);
}
if (ret)
goto out;
image_debug(image, "copying %llu bytes from %s at offset %llu\n",
Expand Down

0 comments on commit 041ae74

Please sign in to comment.