Skip to content

Commit

Permalink
Fix file open check
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Calandracas606 committed Jan 18, 2024
1 parent d405836 commit eba148a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/src/Utils/File.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit eba148a

Please sign in to comment.