commit - 6b89d48589d6584c63c8b9dd8b0abde8501bcc92
commit + b5c9579e6c5505125ac9ce171891e126c1c728e0
blob - 422e04b7301dc1eabacadbf80babcfbf4a4a780c
blob + ed4a42c8e7fbdbf1ea8ba1623c3b4086ea2975b4
--- libexec/got-read-blob/got-read-blob.c
+++ libexec/got-read-blob/got-read-blob.c
for (;;) {
struct imsg imsg, imsg_outfd;
FILE *f = NULL;
- int fd = -1, outfd = -1;
+ int fd = -1, outfd = -1, finished = 0;
size_t size;
struct got_object *obj = NULL;
uint8_t *buf = NULL;
break;
}
- if (imsg.hdr.type == GOT_IMSG_STOP)
- break;
+ if (imsg.hdr.type == GOT_IMSG_STOP) {
+ finished = 1;
+ goto done;
+ }
+
if (imsg.hdr.type != GOT_IMSG_BLOB_REQUEST) {
err = got_error(GOT_ERR_PRIVSEP_MSG);
goto done;
imsg_free(&imsg);
imsg_free(&imsg_outfd);
- if (obj)
+ if (obj) {
got_object_close(obj);
- if (err)
+ obj = NULL;
+ }
+
+ if (err || finished)
break;
}
blob - 4ac05983cd59f84ead60fa06a07e955c296526be
blob + 23b2abd2788e35db9dd24a8099d4a6d5649c8245
--- libexec/got-read-gitconfig/got-read-gitconfig.c
+++ libexec/got-read-gitconfig/got-read-gitconfig.c
for (;;) {
struct imsg imsg;
- int fd = -1;
+ int fd = -1, finished = 0;
memset(&imsg, 0, sizeof(imsg));
break;
}
- if (imsg.hdr.type == GOT_IMSG_STOP)
- break;
+ if (imsg.hdr.type == GOT_IMSG_STOP) {
+ finished = 1;
+ goto done;
+ }
switch (imsg.hdr.type) {
case GOT_IMSG_GITCONFIG_PARSE_REQUEST:
break;
}
+ done:
if (fd != -1) {
if (close(fd) == -1 && err == NULL)
err = got_error_from_errno("close");
}
imsg_free(&imsg);
- if (err)
+ if (err || finished)
break;
}
blob - 023e1e44753cb9815d503bb8fa0ce3cd6cfc8dbb
blob + 5a37a25517b9cd8bab47170ae805b3ac8d244c4d
--- libexec/got-read-gotconfig/got-read-gotconfig.c
+++ libexec/got-read-gotconfig/got-read-gotconfig.c
for (;;) {
struct imsg imsg;
- int fd = -1;
+ int fd = -1, finished = 0;
memset(&imsg, 0, sizeof(imsg));
break;
}
- if (imsg.hdr.type == GOT_IMSG_STOP)
- break;
+ if (imsg.hdr.type == GOT_IMSG_STOP) {
+ finished = 1;
+ goto done;
+ }
switch (imsg.hdr.type) {
case GOT_IMSG_GOTCONFIG_PARSE_REQUEST:
err = got_error(GOT_ERR_PRIVSEP_MSG);
break;
}
-
+ done:
if (fd != -1) {
if (close(fd) == -1 && err == NULL)
err = got_error_from_errno("close");
}
imsg_free(&imsg);
- if (err)
+ if (err || finished)
break;
}
blob - c9b8f3a854b61080b46effafa1086a6a3ad9f1af
blob + 9bd7dc6de046f0f489c6c1a59c01fa89884c6a28
--- libexec/got-read-object/got-read-object.c
+++ libexec/got-read-object/got-read-object.c
#endif
for (;;) {
- int fd = -1, outfd = -1;
+ int fd = -1, outfd = -1, finished = 0;
if (sigint_received) {
err = got_error(GOT_ERR_CANCELLED);
break;
}
- if (imsg.hdr.type == GOT_IMSG_STOP)
- break;
+ if (imsg.hdr.type == GOT_IMSG_STOP) {
+ finished = 1;
+ goto done;
+ }
if (imsg.hdr.type != GOT_IMSG_OBJECT_REQUEST &&
imsg.hdr.type != GOT_IMSG_RAW_OBJECT_REQUEST) {
if (fd != -1 && close(fd) == -1 && err == NULL)
err = got_error_from_errno("close");
imsg_free(&imsg);
- if (obj)
+ if (obj) {
got_object_close(obj);
- if (err)
+ obj = NULL;
+ }
+ if (err || finished)
break;
}