Revert "sideband: use writev(3p) to send pktlines"

This reverts commit 26986f4cbaf38d84a82b0b35da211389ce49552c; let's
not use writev() for now.
This commit is contained in:
Junio C Hamano
2026-04-09 14:47:51 -07:00
parent 9c30dddefd
commit 74fbd8a571

View File

@@ -264,7 +264,6 @@ void send_sideband(int fd, int band, const char *data, ssize_t sz, int packet_ma
const char *p = data;
while (sz) {
struct iovec iov[2];
unsigned n;
char hdr[5];
@@ -274,19 +273,12 @@ void send_sideband(int fd, int band, const char *data, ssize_t sz, int packet_ma
if (0 <= band) {
xsnprintf(hdr, sizeof(hdr), "%04x", n + 5);
hdr[4] = band;
iov[0].iov_base = hdr;
iov[0].iov_len = 5;
write_or_die(fd, hdr, 5);
} else {
xsnprintf(hdr, sizeof(hdr), "%04x", n + 4);
iov[0].iov_base = hdr;
iov[0].iov_len = 4;
write_or_die(fd, hdr, 4);
}
iov[1].iov_base = (void *) p;
iov[1].iov_len = n;
writev_or_die(fd, iov, ARRAY_SIZE(iov));
write_or_die(fd, p, n);
p += n;
sz -= n;
}