fopen not returning NULL on failure
Closed this issue · 4 comments
I've noticed in the latest versions that fopen doesn't return 0 when a file isn't found. For example the following code will abort even though a file named /blahblah does not exist.
FILE* filetest = 0;
filetest = fopen("/blahblah", "rb");
if(filetest)
{
abort();
}
I'm using the latest version of PSL1GHT with ps3toolchain. The issue was introduced in the commits of the past few days. I can reproduce the error by pasting the code at the beginning of any of the samples.
Hi RoboHobo
I believe your right, the open (which is used by the fopen of newlib) syscall should return -1 instead of errno when there is an error.
I've made a little patch on my repo ( git://github.com/cebash/PSL1GHT.git ), could you test it ? otherwise i'll try it tonight.
Thx
That fixed it, thanks
OK thx
I issued an pull request => I'll close the issue when the merge will occur :)
Should be fixed with recent merge.