 
                            ...
These examples also assume that errno is set if fopen() fails. This is  or malloc() fail. These are guaranteed by POSIX but not by C11. See ERR30-C. Set errno to zero before calling a library function known to set errno, and check errno only after the function returns a value indicating failure for more details.
...