Fix bug in return value check of ::read().