X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=sideband.c;h=d5ffa1c8919a6db750606c78a1b44d8618fa35a5;hb=15f07e061e272079229d1ab2799d8e7a4f65213f;hp=899b1ff36619d0077dced9da77f538ab98396a83;hpb=5e64650d938d7a23b73532b4a68bc6bd08cfd041;p=git.git diff --git a/sideband.c b/sideband.c index 899b1ff36..d5ffa1c89 100644 --- a/sideband.c +++ b/sideband.c @@ -135,9 +135,14 @@ ssize_t send_sideband(int fd, int band, const char *data, ssize_t sz, int packet n = sz; if (packet_max - 5 < n) n = packet_max - 5; - sprintf(hdr, "%04x", n + 5); - hdr[4] = band; - safe_write(fd, hdr, 5); + if (0 <= band) { + sprintf(hdr, "%04x", n + 5); + hdr[4] = band; + safe_write(fd, hdr, 5); + } else { + sprintf(hdr, "%04x", n + 4); + safe_write(fd, hdr, 4); + } safe_write(fd, p, n); p += n; sz -= n;