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>
This commit is contained in:

committed by
Junio C Hamano

parent
f5615d2467
commit
743c4b7b0f
@ -129,7 +129,7 @@ int packet_read_line(int fd, char *buffer, unsigned size)
|
|||||||
safe_read(fd, linelen, 4);
|
safe_read(fd, linelen, 4);
|
||||||
len = packet_length(linelen);
|
len = packet_length(linelen);
|
||||||
if (len < 0)
|
if (len < 0)
|
||||||
die("protocol error: bad line length character");
|
die("protocol error: bad line length character: %.4s", linelen);
|
||||||
if (!len)
|
if (!len)
|
||||||
return 0;
|
return 0;
|
||||||
len -= 4;
|
len -= 4;
|
||||||
|
Reference in New Issue
Block a user