Work around compiler based errno conversion, use loop instead.

Since the error codes aren't simply counting up from 1 under Haiku the
trick to use an array to map them doesn't really work out. Use a struct
and a loop instead.