diff mbox series

[1/2] gcrypt: test_tls_psk_init should write binary file instead text file.

Message ID 20201013010310.497-2-luoyonggang@gmail.com (mailing list archive)
State New, archived
Headers show
Series Fixes gcrypt testing on msys2/mingw | expand

Commit Message

Yonggang Luo Oct. 13, 2020, 1:03 a.m. UTC
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 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Philippe Mathieu-Daudé Oct. 13, 2020, 10:52 a.m. UTC | #1
On 10/13/20 3:03 AM, Yonggang Luo wrote:
> 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 | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tests/crypto-tls-psk-helpers.c b/tests/crypto-tls-psk-helpers.c
> index a8395477c3..11ae26368c 100644
> --- a/tests/crypto-tls-psk-helpers.c
> +++ b/tests/crypto-tls-psk-helpers.c
> @@ -32,7 +32,7 @@ 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();
> 

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
diff mbox series

Patch

diff --git a/tests/crypto-tls-psk-helpers.c b/tests/crypto-tls-psk-helpers.c
index a8395477c3..11ae26368c 100644
--- a/tests/crypto-tls-psk-helpers.c
+++ b/tests/crypto-tls-psk-helpers.c
@@ -32,7 +32,7 @@  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();