common: fix SafeWrite error msg

This commit is contained in:
Eric Wasylishen 2018-02-09 11:05:11 -07:00
parent 339c1d0219
commit 992484f173
1 changed files with 3 additions and 2 deletions

View File

@ -482,8 +482,9 @@ SafeRead(FILE *f, void *buffer, int count)
void
SafeWrite(FILE *f, const void *buffer, int count)
{
if (fwrite(buffer, 1, count, f) != (size_t) count)
Error("File read failure");
const size_t written = fwrite(buffer, 1, count, f);
if (written != (size_t) count)
Error("File write failure");
}
typedef struct {