Re: [PATCH] system_path: use a static buffer
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Mar 18, 2011, 07:25 UTC
- Message-ID
- <7vpqpoyjo3.fsf@alter.siamese.dyndns.org>
- In-Reply-To
- <1300371853-8965-1-git-send-email-cmn@elego.de>
Carlos Martín Nieto <cmn@elego.de> writes:
Show 5 quoted lines
> + ret = snprintf(buf, sizeof(buf), "%s/%s", prefix, path);
> + if (ret >= sizeof(buf))
> + die("system path too long for %s", path);
> + else if (ret < 0)
> + die_errno("encoding error");POSIX says snprintf() should set errno in this case, and your use of die_errno() would show that information, but what is "encoding error"?
Just being curious, as I suspect that "snprintf() returned an error" may be more appropriate, if the answer is "I don't know what kind of error it is, but snprintf() found something faulty while encoding so I chose to call it encoding error".
By the way, thanks for checking all the callers.