diff options
author | Matheus Tavares <matheus.bernardino@usp.br> | 2021-04-15 21:57:52 (GMT) |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2021-04-15 22:05:31 (GMT) |
commit | 332ec963bc6fedc0ca9c0b5a66ea842d7fbd6baa (patch) | |
tree | 4fd67b074cf1faa9e66724fe7b7ddfc5e0e211fb /builtin/commit.c | |
parent | 54a391711554ed41b4b0792cfef004abc74893bd (diff) | |
download | git-332ec963bc6fedc0ca9c0b5a66ea842d7fbd6baa.zip git-332ec963bc6fedc0ca9c0b5a66ea842d7fbd6baa.tar.gz git-332ec963bc6fedc0ca9c0b5a66ea842d7fbd6baa.tar.bz2 |
pkt-line: do not report packet write errors twice
On write() errors, packet_write() dies with the same error message that
is already printed by its callee, packet_write_gently(). This produces
an unnecessarily verbose and repetitive output:
error: packet write failed
fatal: packet write failed: <strerror() message>
In addition to that, packet_write_gently() does not always fulfill its
caller expectation that errno will be properly set before a non-zero
return. In particular, that is not the case for a "data exceeds max
packet size" error. So, in this case, packet_write() will call
die_errno() and print an strerror(errno) message that might be totally
unrelated to the actual error.
Fix both those issues by turning packet_write() and
packet_write_gently() into wrappers to a common lower level function
that doesn't print the error message, but instead returns it on a buffer
for the caller to die() or error() as appropriate.
Signed-off-by: Matheus Tavares <matheus.bernardino@usp.br>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/commit.c')
0 files changed, 0 insertions, 0 deletions