ref: 01038bc020424a53c55e512afe12c0e7e6a31ec2
parent: 9e71dbbd21c72ef8f5a1478efa1596fe1b353307
author: Thomas A. Birkel <[email protected]>
date: Tue Nov 22 02:03:42 EST 2016
hexen/sv_save.c: revert 9e71dbb, fix fwrite check The condition and message under fwrite() was a near-copy of the corresponding fread() case: it now checks and displays correctly.
--- a/src/hexen/sv_save.c
+++ b/src/hexen/sv_save.c
@@ -3257,7 +3257,7 @@
byte *buffer;
int file_length, file_remaining;
FILE *read_handle, *write_handle;
- int buf_count, read_count;
+ int buf_count, read_count, write_count;
read_handle = fopen(source_name, "rb");
if (read_handle == NULL)
@@ -3300,9 +3300,10 @@
I_Error ("Couldn't read file %s", source_name);
}
- if (read_count < buf_count)
+ write_count = fwrite(buffer, 1, buf_count, write_handle);
+ if (write_count < buf_count)
{
- I_Error ("Couldn't read file %s", dest_name);
+ I_Error ("Couldn't write to file %s", dest_name);
}
file_remaining -= buf_count;