From: Logan Gunthorpe Date: Fri, 18 Nov 2022 23:16:00 +0000 (-0700) Subject: lib/pattern: Support binary pattern buffers on windows X-Git-Tag: fio-3.34~86 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=1fb215e991d260a128e35d761f6850e8d9e4c333;p=fio.git lib/pattern: Support binary pattern buffers on windows On windows, binary files used as pattern buffers may be mangled or truncated seeing the files are openned in text mode. Fix this by passing O_BINARY on windows when openning the file. Suggested-by: Vincent Fu Signed-off-by: Logan Gunthorpe Signed-off-by: Vincent Fu --- diff --git a/lib/pattern.c b/lib/pattern.c index 1ae05758..9be29af6 100644 --- a/lib/pattern.c +++ b/lib/pattern.c @@ -47,7 +47,11 @@ static const char *parse_file(const char *beg, char *out, if (file == NULL) goto err_out; +#ifdef _WIN32 + fd = open(file, O_RDONLY | O_BINARY); +#else fd = open(file, O_RDONLY); +#endif if (fd < 0) goto err_free_out;