Better errno checking

Compare with string representation instead of numeric constant.