Malta has agreed it would take in a second ship carrying 234 people, after it was stuck on the Mediterranean for days.