fd: Let write_all() return an error on short writes.