use errno field to check error number, instead of parsing string