...
This noncompliant code example, however, does comply with 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 failureOnly inspect errno after calling functions known to use errno to report errors.
Compliant Solution
In this compliant solution, the opener()
function returns a value of type errno_t
, providing a clear indication that this function returns an error code.
...