today i meet a bug , if i open the log, everything is ok, if i close the log, the bug is comming! my god , long time ago , i met the same bug, today the same , i don't know why, but i need to remove the log, or bug always in!
i have get it , when function define to be void, but used it as int, and you used the return to compare, the printf may make it just look like successful.