Skip to content

Commit 2db34c2

Browse files
Fix file open check (#98)
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
1 parent 6d046df commit 2db34c2

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

lib/src/Utils/File.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ cl_int cl_util_write_binaries(const cl_program program,
248248

249249
// write the binary to the output file
250250
FILE *f = NULL;
251-
if (fopen_s(&f, filename, "wb") != 0)
251+
if (fopen_s(&f, filename, "wb") == 0)
252252
{
253253
if (fwrite(binaries_ptr[i], sizeof(unsigned char), binaries_size[i],
254254
f)

0 commit comments

Comments
 (0)