discover: Fix accept() return value check