• S
    Handle broken vsnprintf implementations in strbuf · f141bd80
    Shawn O. Pearce 提交于
    Solaris 9's vsnprintf implementation returns -1 if we pass it a
    buffer of length 0.  The only way to get it to give us the actual
    length necessary for the formatted string is to grow the buffer
    out to have at least 1 byte available in the strbuf and then ask
    it to compute the length.
    
    If the available space is 0 I'm growing it out by 64 to ensure
    we will get an accurate length estimate from all implementations.
    Some callers may need to grow the strbuf again but 64 should be a
    reasonable enough initial growth.
    
    We also no longer silently fail to append to the string when we are
    faced with a broken vsnprintf implementation.  On Solaris 9 this
    silent failure caused me to no longer be able to execute "git clone"
    as we tried to exec the empty string rather than "git-clone".
    Signed-off-by: NShawn O. Pearce <spearce@spearce.org>
    Signed-off-by: NJunio C Hamano <gitster@pobox.com>
    f141bd80
strbuf.c 4.1 KB