diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2025-07-15 16:53:23 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2025-07-15 16:54:11 -0400 |
commit | 5f926277835d42b57744faa208b16e616fc479b8 (patch) | |
tree | a32f9b3f170b8b88a645fac7157100195ab4b89b | |
parent | e1e87f53cdfeb048747b1e6fa1d1a44b4a85376e (diff) |
cmd_image_update: Fix truncate call at the start of update
We don't want to make the image smaller until we've finished updating.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
-rw-r--r-- | c_src/cmd_image.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/c_src/cmd_image.c b/c_src/cmd_image.c index 58268b4b..0d947da9 100644 --- a/c_src/cmd_image.c +++ b/c_src/cmd_image.c @@ -635,7 +635,7 @@ static int image_update(const char *src_path, const char *dst_image, u64 input_bytes = count_input_size(src_fd); - if (truncate(dst_image, input_bytes * 2)) + if (truncate(dst_image, xstat(dst_image).st_size + input_bytes * 2)) die("truncate error: %m"); darray_const_str device_paths = {}; |