Replace strerror by strerror_r

Use thread safe strerror_r.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Cleanup test code

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>