Be more precise on memsets
Two bytes were being overlooked in the MBR. They were being written
correctly (since they were 0), but now all bytes are accounted for so
there's no need to memset the whole MBR to zero at the beginning.
@@ -211,15 +211,20 @@ static int mbr_create(const struct mbr_partition partitions[4],
if (mbr_verify(partitions) < 0)
return -1;
- memset(output, 0, 512);
if (bootstrap)
memcpy(output, bootstrap, 440);
+ else
+ memset(output, 0, 440);
if (osip->include_osip && write_osip(osip, output) < 0)
return -1;
copy_le32(&output[440], signature);
+ // Not copy protected?
+ output[444] = 0;
+ output[445] = 0;
+
int i;
for (i = 0; i < 4; i++) {
if (create_partition(&partitions[i], &output[446 + i * 16], num_blocks) < 0)
