Skip to content

Commit

Permalink
Fix file open check (#98)
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 authored Feb 2, 2024
1 parent 6d046df commit 2db34c2
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 2db34c2

Please sign in to comment.