smuehlst / circle-stdlib

Standard C and C++ Library Support for Circle

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

fopen returns non-NULL on non-existing file

olfp opened this issue · comments

Environment: circle-stdlib v15.3
When I try to open a non-existing file, the "fopen" call wrongly returns a non-NULL value.

Verification: I modified sample 03-stdio-fatfs to use the name of a non-existing file for the fp = fopen(..., "r") call. Printing the value of fp via printf("...%p", fp) reveals a non-NULL value (for example on my Pi 3B+ always 0x5172cc). Also, errno is not set, i.e. 0.

Code:
FILE* fp = fopen("error.txt", "r");
printf("fopen returns: %p, errno is: %d\n", fp, errno);

Result:
open returns: 0x5172cc, errno is: 0

Thanks for the report, nice catch. This is now fixed in release v15.4.