pay attention to closedir() return value.