Fix the logic used for retrying reads after EINVAL

The previous way of testing for EINVAL here would have retried
indefinitely for as long as EINVAL was returned, instead of giving up
after five tries (as was obviously the intent). This commit makes it
retry only if tries is less than 5, rather than if tries is equal to 5.