The variable errno
holds the last error code encountered by a library function. This variable must be cleared by the user prior to calling a library function.
The errno
global variable is not safe to use in a threaded or multi-task system. A race condition can occur if a task is interrupted between the call which sets error
and when the task examines errno
. If another task changes errno
during this time, the result will be incorrect for the interrupted task.
int errno