pkt-line: Make packet_read_line easier to debug
When there is an error parsing the 4 byte length component we now display it as part of the die message, this may hint as to what data was misunderstood by the application. Signed-off-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Shawn O. Pearce committed
Oct 30, 2009 at 17:47 UTC
743c4b7b0fa5422d1bb5dc59c6cb919a881dd98b
1 file changed
+1
-1
pkt-line.c
+1
-1
@@ -129,7 +129,7 @@ int packet_read_line(int fd, char *buffer, unsigned size)
129
safe_read(fd, linelen, 4);
130
len = packet_length(linelen);
131
if (len < 0)
132
- die("protocol error: bad line length character");
132
+ die("protocol error: bad line length character: %.4s", linelen);
133
if (!len)
134
return 0;
135
len -= 4;