mirror of
https://github.com/dgibson/dtc.git
synced 2025-10-14 00:37:41 -04:00
dtc: Check return value from fwrite()
There's one place in flattree.c where we currently ignore the return value from fwrite(). On some gcc/glibc versions, where fwrite() is declared with attribute warn_unused_result, this causes a warning. This patch fixes the warning, by checking the fwrite() result. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
This commit is contained in:
parent
f99cd158a9
commit
0783d7e705
1 changed files with 7 additions and 4 deletions
11
flattree.c
11
flattree.c
|
@ -413,10 +413,13 @@ void dt_to_blob(FILE *f, struct boot_info *bi, int version)
|
||||||
if (padlen > 0)
|
if (padlen > 0)
|
||||||
blob = data_append_zeroes(blob, padlen);
|
blob = data_append_zeroes(blob, padlen);
|
||||||
|
|
||||||
fwrite(blob.val, blob.len, 1, f);
|
if (fwrite(blob.val, blob.len, 1, f) != 1) {
|
||||||
|
if (ferror(f))
|
||||||
if (ferror(f))
|
die("Error writing device tree blob: %s\n",
|
||||||
die("Error writing device tree blob: %s\n", strerror(errno));
|
strerror(errno));
|
||||||
|
else
|
||||||
|
die("Short write on device tree blob\n");
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* data_merge() frees the right-hand element so only the blob
|
* data_merge() frees the right-hand element so only the blob
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue