refs.c: make update_ref_write update a strbuf on failure