Set global errno value accordingly.

Signed-off-by: Krzysztof Wilczynski <krzysztof.wilczynski@linux.com>