summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNelson Elhage <nelhage@nelhage.com>2018-06-28 05:27:36 +0000
committerNelson Elhage <nelhage@nelhage.com>2018-06-28 05:28:08 +0000
commit895a668e19dc596e7b12ea27724ceb7b68556106 (patch)
tree21da3f00174c33f33a1f199f55e3cb856a235253
parent90cf86070046fcffd5306915b57786da054d8964 (diff)
downloadlibgit2-895a668e19dc596e7b12ea27724ceb7b68556106.tar.gz
Small style tweak, and set an error
-rw-r--r--src/transports/smart_pkt.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/transports/smart_pkt.c b/src/transports/smart_pkt.c
index df35a6076..07701abcc 100644
--- a/src/transports/smart_pkt.c
+++ b/src/transports/smart_pkt.c
@@ -394,7 +394,17 @@ int git_pkt_parse_line(
len = parse_len(line);
if (len < 0) {
- return GIT_ERROR;
+ /*
+ * If we fail to parse the length, it might be because the
+ * server is trying to send us the packfile already.
+ */
+ if (bufflen >= 4 && !git__prefixcmp(line, "PACK")) {
+ giterr_set(GITERR_NET, "unexpected pack file");
+ } else {
+ giterr_set(GITERR_NET, "bad packet length");
+ }
+
+ return -1;
}
/*