diff options
author | Xuzhou Cheng | 2022-09-25 13:30:18 +0200 |
---|---|---|
committer | Thomas Huth | 2022-09-27 20:51:21 +0200 |
commit | 6b2906d65ca2e1fc2c71be1ce8992eaa3c5d7eab (patch) | |
tree | c6637d79b7fac5697357899d4c58a53316cd1040 /tests | |
parent | tests/qtest: migration-test: Disable IO redirection for win32 (diff) | |
download | qemu-6b2906d65ca2e1fc2c71be1ce8992eaa3c5d7eab.tar.gz qemu-6b2906d65ca2e1fc2c71be1ce8992eaa3c5d7eab.tar.xz qemu-6b2906d65ca2e1fc2c71be1ce8992eaa3c5d7eab.zip |
tests/qtest: ide-test: Open file in binary mode
By default Windows opens file in text mode, while a POSIX compliant
implementation treats text files and binary files the same.
The fopen() 'mode' string can include the letter 'b' to indicate
binary mode shall be used. POSIX spec says the character 'b' shall
have no effect, but is allowed for ISO C standard conformance.
Let's add the letter 'b' which works on both POSIX and Windows.
Signed-off-by: Xuzhou Cheng <xuzhou.cheng@windriver.com>
Signed-off-by: Bin Meng <bin.meng@windriver.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20220925113032.1949844-41-bmeng.cn@gmail.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/qtest/ide-test.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/tests/qtest/ide-test.c b/tests/qtest/ide-test.c index 5e3e28aea2..4ea89c26c9 100644 --- a/tests/qtest/ide-test.c +++ b/tests/qtest/ide-test.c @@ -892,7 +892,7 @@ static void cdrom_pio_impl(int nblocks) /* Prepopulate the CDROM with an interesting pattern */ generate_pattern(pattern, patt_len, ATAPI_BLOCK_SIZE); - fh = fopen(tmp_path, "w+"); + fh = fopen(tmp_path, "wb+"); ret = fwrite(pattern, ATAPI_BLOCK_SIZE, patt_blocks, fh); g_assert_cmpint(ret, ==, patt_blocks); fclose(fh); @@ -993,7 +993,7 @@ static void test_cdrom_dma(void) prdt[0].size = cpu_to_le32(len | PRDT_EOT); generate_pattern(pattern, ATAPI_BLOCK_SIZE * 16, ATAPI_BLOCK_SIZE); - fh = fopen(tmp_path, "w+"); + fh = fopen(tmp_path, "wb+"); ret = fwrite(pattern, ATAPI_BLOCK_SIZE, 16, fh); g_assert_cmpint(ret, ==, 16); fclose(fh); |