From eba148ac54239b3daef4cfe81726a594d06e2eb5 Mon Sep 17 00:00:00 2001 From: Daniel Martinez Date: Thu, 18 Jan 2024 14:45:18 -0500 Subject: [PATCH] Fix file open check fopen_s, (and the defined macro), return 0 on success. The if statement is broken. This can be easily tested by running the "binaries" sample --- lib/src/Utils/File.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/src/Utils/File.c b/lib/src/Utils/File.c index 5cf80d1f..a806da4a 100644 --- a/lib/src/Utils/File.c +++ b/lib/src/Utils/File.c @@ -248,7 +248,7 @@ cl_int cl_util_write_binaries(const cl_program program, // write the binary to the output file FILE *f = NULL; - if (fopen_s(&f, filename, "wb") != 0) + if (fopen_s(&f, filename, "wb") == 0) { if (fwrite(binaries_ptr[i], sizeof(unsigned char), binaries_size[i], f)