Skip to content

Commit 4a9adbd

Browse files
author
Noam Preil
committed
.bin writer: ensure data is successfully written
1 parent 5b99c69 commit 4a9adbd

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

linker/bin.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,5 @@
33
#include <stdint.h>
44

55
int output_bin(FILE *f, uint8_t *data, int data_length) {
6-
fwrite(data, sizeof(uint8_t), data_length, f);
7-
return 0;
6+
return fwrite(data, sizeof(uint8_t), data_length, f) == (unsigned)data_length ? 0 : 1;
87
}

0 commit comments

Comments
 (0)