safer usage of errno