mirror of
https://github.com/git-for-windows/git.git
synced 2026-04-10 08:22:54 -05:00
Revert "sideband: use writev(3p) to send pktlines"
This reverts commit 26986f4cbaf38d84a82b0b35da211389ce49552c; let's not use writev() for now.
This commit is contained in:
14
sideband.c
14
sideband.c
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user