Set errno=0 before using it.