1
0
mirror of https://git.disroot.org/80486DX2-66/polonium.git synced 2024-12-26 15:10:40 +05:30

corrupter.c: optimize file I/O

This commit is contained in:
Intel A80486DX2-66 2024-11-19 22:04:43 +03:00
parent 07c0d1af8a
commit 0ca825d72e
Signed by: 80486DX2-66
GPG Key ID: 83631EF27054609B

View File

@ -79,17 +79,18 @@ enum Interoperation_Result corrupt_byte(Interoperation_Input_Vars) {
byte_value = FLIP_BIT(byte_value, bit);
damaged_byte = true;
}
if (damaged_byte) {
// write the modified byte back to the file
FSEEK_MACRO(file, i, SEEK_SET);
if (fwrite(&byte_value, sizeof(byte), 1, file) != 1)
// on error
return INTEROPERATION_ERROR;
}
if (damaged_byte)
result->damaged_bytes++;
}
return INTEROPERATION_SUCCESS;
}