summaryrefslogtreecommitdiff
path: root/sideband.c
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2011-11-10 09:10:51 -0800
committerLibravatar Junio C Hamano <gitster@pobox.com>2011-11-10 09:10:51 -0800
commitc444c16589f95ac22d8e3ffe603cd7f0613512ce (patch)
tree31d2e0c2a77344201af6f3ee5427f47218dec9bb /sideband.c
parentMerge 'build-in git-mktree' (diff)
parentMove 'builtin-*' into a 'builtin/' subdirectory (diff)
downloadtgif-c444c16589f95ac22d8e3ffe603cd7f0613512ce.tar.xz
Merge "Move 'builtin-*' into a 'builtin/' subdirectory"
Diffstat (limited to 'sideband.c')
-rw-r--r--sideband.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/sideband.c b/sideband.c
index 899b1ff366..d5ffa1c891 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;