From c30999562e0a0e03d1412b16fb33b5874ed96914 Mon Sep 17 00:00:00 2001 From: vanhauser-thc Date: Fri, 16 Apr 2021 15:02:36 +0200 Subject: fix compcovtest --- qemu_mode/libcompcov/compcovtest.cc | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'qemu_mode/libcompcov/compcovtest.cc') diff --git a/qemu_mode/libcompcov/compcovtest.cc b/qemu_mode/libcompcov/compcovtest.cc index 92e3864c..3c975e15 100644 --- a/qemu_mode/libcompcov/compcovtest.cc +++ b/qemu_mode/libcompcov/compcovtest.cc @@ -50,17 +50,28 @@ int main(int argc, char **argv) { strncmp(&buffer[20], "jumps over ", 11) != 0 || strcmp(&buffer[31], "the lazy dog") != 0) { + if (argc > 1) { fclose(file); } return 1; } uint64_t x = 0; fread(&x, sizeof(x), 1, file); - if (x != 0xCAFEBABECAFEBABE) { return 2; } + if (x != 0xCAFEBABECAFEBABE) { + + if (argc > 1) { fclose(file); } + return 2; + + } uint32_t y = 0; fread(&y, sizeof(y), 1, file); - if (y != 0xDEADC0DE) { return 3; } + if (y != 0xDEADC0DE) { + + if (argc > 1) { fclose(file); } + return 3; + + } uint16_t z = 0; fread(&z, sizeof(z), 1, file); @@ -71,6 +82,7 @@ int main(int argc, char **argv) { break; default: + if (argc > 1) { fclose(file); } return 4; } -- cgit 1.4.1