tests/bios-tables-test: check the value returned by fopen()
The function fopen() may fail, so check its return value. Signed-off-by: zhanghailiang <zhang.zhanghailiang@huawei.com> Signed-off-by: Li Liu <john.liuli@huawei.com> Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
This commit is contained in:
parent
d70724cec8
commit
c39a28a43d
@ -790,6 +790,11 @@ int main(int argc, char *argv[])
|
||||
const char *arch = qtest_get_arch();
|
||||
FILE *f = fopen(disk, "w");
|
||||
int ret;
|
||||
|
||||
if (!f) {
|
||||
fprintf(stderr, "Couldn't open \"%s\": %s", disk, strerror(errno));
|
||||
return 1;
|
||||
}
|
||||
fwrite(boot_sector, 1, sizeof boot_sector, f);
|
||||
fclose(f);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user