aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--block.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/block.c b/block.c
index 077c278557..efd96e637f 100644
--- a/block.c
+++ b/block.c
@@ -444,6 +444,9 @@ int bdrv_write(BlockDriverState *bs, int64_t sector_num,
return -1;
if (bs->read_only)
return -1;
+ if (sector_num == 0 && bs->boot_sector_enabled && nb_sectors > 0) {
+ memcpy(bs->boot_sector_data, buf, 512);
+ }
return bs->drv->bdrv_write(bs, sector_num, buf, nb_sectors);
}