• J
    config: set errno in numeric git_parse_* functions · 33fdd77e
    Jeff King 提交于
    When we are parsing an integer or unsigned long, we use
    the strto*max functions, which properly set errno to ERANGE
    if we get a large value. However, we also do further range
    checks after applying our multiplication factor, but do not
    set ERANGE. This means that a caller cannot tell if an error
    was caused by ERANGE or if the input was simply not a valid
    number.
    
    This patch teaches git_parse_signed and git_parse_unsigned to set
    ERANGE for range errors, and EINVAL for other errors, so that the
    caller can reliably tell these cases apart.
    Signed-off-by: NJeff King <peff@peff.net>
    Signed-off-by: NJunio C Hamano <gitster@pobox.com>
    33fdd77e
config.c 42.4 KB