From: Junio C Hamano Date: Mon, 30 May 2011 07:09:41 +0000 (-0700) Subject: Merge branch 'jm/maint-misc-fix' into maint X-Git-Tag: v1.7.5.4~14 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=5b42477b59886a85d4b49a60313f9b9d4a0d576f;p=git.git Merge branch 'jm/maint-misc-fix' into maint * jm/maint-misc-fix: read_gitfile_gently: use ssize_t to hold read result remove tests of always-false condition rerere.c: diagnose a corrupt MERGE_RR when hitting EOF between TAB and '\0' --- 5b42477b59886a85d4b49a60313f9b9d4a0d576f diff --cc fsck.c index 6f266c1ea,c17a538de..60bd4bbf6 --- a/fsck.c +++ b/fsck.c @@@ -347,14 -347,26 +347,14 @@@ int fsck_object(struct object *obj, in int fsck_error_function(struct object *obj, int type, const char *fmt, ...) { va_list ap; - int len; struct strbuf sb = STRBUF_INIT; - strbuf_addf(&sb, "object %s:", obj->sha1?sha1_to_hex(obj->sha1):"(null)"); + strbuf_addf(&sb, "object %s:", sha1_to_hex(obj->sha1)); va_start(ap, fmt); - len = vsnprintf(sb.buf + sb.len, strbuf_avail(&sb), fmt, ap); + strbuf_vaddf(&sb, fmt, ap); va_end(ap); - if (len < 0) - len = 0; - if (len >= strbuf_avail(&sb)) { - strbuf_grow(&sb, len + 2); - va_start(ap, fmt); - len = vsnprintf(sb.buf + sb.len, strbuf_avail(&sb), fmt, ap); - va_end(ap); - if (len >= strbuf_avail(&sb)) - die("this should not happen, your snprintf is broken"); - } - error("%s", sb.buf); strbuf_release(&sb); return 1;