[PATCH v9 11/26] gcrypt: test_tls_psk_init should write binary file instead text file.

Yonggang Luo posted 26 patches 5 years, 4 months ago
Maintainers: Kevin Wolf <kwolf@redhat.com>, Gerd Hoffmann <kraxel@redhat.com>, Ed Maste <emaste@freebsd.org>, Stefan Hajnoczi <stefanha@redhat.com>, Peter Lieven <pl@kamp.de>, Li-Wen Hsu <lwhsu@freebsd.org>, Max Reitz <mreitz@redhat.com>, Fam Zheng <fam@euphon.net>, Stefan Weil <sw@weilnetz.de>, "Daniel P. Berrangé" <berrange@redhat.com>
There is a newer version of this series
[PATCH v9 11/26] gcrypt: test_tls_psk_init should write binary file instead text file.
Posted by Yonggang Luo 5 years, 4 months ago
On windows, if open file with "w", it's will automatically convert
"\n" to "\r\n" when writing to file.

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
---
 tests/crypto-tls-psk-helpers.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/tests/crypto-tls-psk-helpers.c b/tests/crypto-tls-psk-helpers.c
index a8395477c3..4f3bd446ad 100644
--- a/tests/crypto-tls-psk-helpers.c
+++ b/tests/crypto-tls-psk-helpers.c
@@ -26,13 +26,15 @@
 #include "crypto-tls-psk-helpers.h"
 #include "qemu/sockets.h"
 
+#include <glib/gstdio.h>
+
 #ifdef QCRYPTO_HAVE_TLS_TEST_SUPPORT
 
 void test_tls_psk_init(const char *pskfile)
 {
     FILE *fp;
 
-    fp = fopen(pskfile, "w");
+    fp = fopen(pskfile, "wb");
     if (fp == NULL) {
         g_critical("Failed to create pskfile %s", pskfile);
         abort();
-- 
2.28.0.windows.1