qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 38/51] tests/qtest: {ahci,ide}-test: Open file in binary mode


From: Thomas Huth
Subject: Re: [PATCH 38/51] tests/qtest: {ahci,ide}-test: Open file in binary mode
Date: Thu, 25 Aug 2022 14:28:34 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.12.0

On 24/08/2022 11.40, Bin Meng wrote:
From: Xuzhou Cheng <xuzhou.cheng@windriver.com>

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.

Similar situation applies to the open() 'flags' where O_BINARY is
used for binary mode.

Signed-off-by: Xuzhou Cheng <xuzhou.cheng@windriver.com>
Signed-off-by: Bin Meng <bin.meng@windriver.com>
---

  tests/qtest/ahci-test.c | 2 +-
  tests/qtest/ide-test.c  | 4 ++--
  2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/tests/qtest/ahci-test.c b/tests/qtest/ahci-test.c
index bce9ff770c..be11508c75 100644
--- a/tests/qtest/ahci-test.c
+++ b/tests/qtest/ahci-test.c
@@ -1453,7 +1453,7 @@ static int prepare_iso(size_t size, unsigned char **buf, 
char **name)
       * Close the file and reopen it.
       */
      close(fd);
-    fd = open(cdrom_path, O_WRONLY);
+    fd = open(cdrom_path, O_WRONLY | O_BINARY);
      g_assert(fd != -1);
  #endif

Could you please squash this hunk into patch 32/51 where you introduced this code?

 Thomas




reply via email to

[Prev in Thread] Current Thread [Next in Thread]