Just following the recommendations: "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"
I think in general it is not a good idea to set errno after a library call.
In this case it could be done, but
Why not just set errno to 0 in the success case?
On 04/13/17 17:05, Oriol Arcas wrote:
> Fixes bug #2921.
>
> During odp_shm_reserve() mmap is tried with huge pages, and if it fails,
> without huge pages. The first call leaves errno set, which can confuse
> the client app.
>
> In general, errno
Fixes bug #2921.
During odp_shm_reserve() mmap is tried with huge pages, and if it fails,
without huge pages. The first call leaves errno set, which can confuse
the client app.
In general, errno must be cleared before calling any library call known
to set it (see SEI CERT rule ERR30-C).