Browse Source

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>
pull/14/head
zhanghailiang 12 years ago
committed by Michael Tokarev
parent
commit
c39a28a43d
  1. 5
      tests/bios-tables-test.c

5
tests/bios-tables-test.c

@ -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…
Cancel
Save