aboutsummaryrefslogtreecommitdiffstats
path: root/sideband.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2024-03-02 11:03:47 -0800
committerJunio C Hamano <gitster@pobox.com>2024-03-02 11:12:16 -0800
commit36ffba1c7be8d831065adab73a7a215f402ef432 (patch)
tree22c47e677a476743d0979b13ade81b209818b064 /sideband.c
parentfa6c383309557b9d2942c47b75a895ca960ad9f5 (diff)
downloadgit-36ffba1c7be8d831065adab73a7a215f402ef432.tar.gz
sideband: avoid short write(2)
The sideband demultiplexor writes the data it receives on sideband with xwrite(). We can lose data if the underlying write(2) results in a short write. If they are limited to unimportant bytes like eye-candy progress meter, it may be OK to lose them, but lets be careful and ensure that we use write_in_full() instead. Note that the original does not check for errors, and this rewrite does not check for one. At least not yet. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'sideband.c')
-rw-r--r--sideband.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sideband.c b/sideband.c
index 266a67342b..5d8907151f 100644
--- a/sideband.c
+++ b/sideband.c
@@ -220,7 +220,7 @@ int demultiplex_sideband(const char *me, int status,
}
strbuf_addch(scratch, *brk);
- xwrite(2, scratch->buf, scratch->len);
+ write_in_full(2, scratch->buf, scratch->len);
strbuf_reset(scratch);
b = brk + 1;
@@ -247,7 +247,7 @@ cleanup:
die("%s", scratch->buf);
if (scratch->len) {
strbuf_addch(scratch, '\n');
- xwrite(2, scratch->buf, scratch->len);
+ write_in_full(2, scratch->buf, scratch->len);
}
strbuf_release(scratch);
return 1;