From 4f9c6fdb7f3f2482cb2db52b1867d051f8bf1c0f Mon Sep 17 00:00:00 2001 From: "W. Felix Handte" Date: Wed, 5 May 2021 13:13:56 -0400 Subject: [PATCH] Attempt to Fix Windows Build Error --- programs/fileio.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/programs/fileio.c b/programs/fileio.c index 5d7d40ddc..571b35489 100644 --- a/programs/fileio.c +++ b/programs/fileio.c @@ -702,14 +702,19 @@ FIO_openDstFile(FIO_ctx_t* fCtx, FIO_prefs_t* const prefs, /* Windows requires opening the file as a "binary" file to avoid * mangling. This macro doesn't exist on unix. */ const int openflags = O_WRONLY|O_CREAT|O_TRUNC|O_BINARY; + const int fd = _open(dstFileName, openflags, mode); + FILE* f = NULL; + if (fd != -1) { + f = _fdopen(fd, "wb"); + } #else const int openflags = O_WRONLY|O_CREAT|O_TRUNC; -#endif const int fd = open(dstFileName, openflags, mode); FILE* f = NULL; if (fd != -1) { f = fdopen(fd, "wb"); } +#endif if (f == NULL) { DISPLAYLEVEL(1, "zstd: %s: %s\n", dstFileName, strerror(errno)); } -- 2.47.2