trq-2013 check the errno not the return code.
Update unit test.