mirror of
https://git.disroot.org/80486DX2-66/polonium.git
synced 2024-12-27 07:30:23 +05:30
corrupter.c: optimize file I/O
This commit is contained in:
parent
07c0d1af8a
commit
0ca825d72e
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user