commit 047c926f0572281a2cb8f6a7571e204e48eff0d4 from: Omar Polo via: Thomas Adam date: Thu Jun 23 14:09:34 2022 UTC style; set datalen only once commit - eb35d814a71cef3007900867c20d881fcd173039 commit + 047c926f0572281a2cb8f6a7571e204e48eff0d4 blob - 46dfd0130236b332bf98cd8c4af93d819c28c9ee blob + 610c1fa187ef0331d4676663f825674435302972 --- lib/patch.c +++ lib/patch.c @@ -221,6 +221,7 @@ recv_patch(struct imsgbuf *ibuf, int *done, struct got return err; } + datalen = imsg.hdr.len - IMSG_HEADER_SIZE; switch (imsg.hdr.type) { case GOT_IMSG_PATCH_DONE: if (h != NULL && h->len == 0) @@ -233,7 +234,6 @@ recv_patch(struct imsgbuf *ibuf, int *done, struct got goto done; } lastmode = -1; - datalen = imsg.hdr.len - IMSG_HEADER_SIZE; if (datalen != sizeof(hdr)) { err = got_error(GOT_ERR_PRIVSEP_LEN); goto done; @@ -258,7 +258,6 @@ recv_patch(struct imsgbuf *ibuf, int *done, struct got err = got_error(GOT_ERR_PRIVSEP_MSG); goto done; } - datalen = imsg.hdr.len - IMSG_HEADER_SIZE; t = imsg.data; /* at least one char */ if (datalen < 2 || t[datalen-1] != '\0') {