commit 9530fd041d6cad2b6bd30d1e0ae2ea57e557e2b0 from: Stefan Sperling date: Thu Nov 21 21:57:16 2024 UTC do not call imsgbuf_clear() before got_privsep_send_error() in helpers Fixes cosmetic test failures, such as in cmdline/tree.sh. commit - 81a2a66238493b3dd4cb68b5427617b12324797a commit + 9530fd041d6cad2b6bd30d1e0ae2ea57e557e2b0 blob - 2b3a4dc46f7cae5b09ff63b72b2a847ab4a4c172 blob + 7394b47b045055ad496a41b569bdf1df91dc44af --- libexec/got-read-blob/got-read-blob.c +++ libexec/got-read-blob/got-read-blob.c @@ -207,13 +207,13 @@ done: break; } - imsgbuf_clear(&ibuf); if (err) { if (!sigint_received && err->code != GOT_ERR_PRIVSEP_PIPE) { fprintf(stderr, "%s: %s\n", getprogname(), err->msg); got_privsep_send_error(&ibuf, err); } } + imsgbuf_clear(&ibuf); if (close(GOT_IMSG_FD_CHILD) == -1 && err == NULL) err = got_error_from_errno("close"); return err ? 1 : 0; blob - 3d142fc066baece919ade964e448f393a7e6441f blob + 034a161e98bbbad416b248ee00dd5079f9b72335 --- libexec/got-read-commit/got-read-commit.c +++ libexec/got-read-commit/got-read-commit.c @@ -128,13 +128,13 @@ done: break; } - imsgbuf_clear(&ibuf); if (err) { if (!sigint_received && err->code != GOT_ERR_PRIVSEP_PIPE) { fprintf(stderr, "%s: %s\n", getprogname(), err->msg); got_privsep_send_error(&ibuf, err); } } + imsgbuf_clear(&ibuf); if (close(GOT_IMSG_FD_CHILD) == -1 && err == NULL) err = got_error_from_errno("close"); return err ? 1 : 0; blob - 8b423f6fe3ea45c4a4c618387c5b36a91bce632c blob + f14c4010ae283862e918daf53e15ea0e271ae6d2 --- libexec/got-read-gitconfig/got-read-gitconfig.c +++ libexec/got-read-gitconfig/got-read-gitconfig.c @@ -436,13 +436,13 @@ main(int argc, char *argv[]) break; } - imsgbuf_clear(&ibuf); if (err) { if (!sigint_received && err->code != GOT_ERR_PRIVSEP_PIPE) { fprintf(stderr, "%s: %s\n", getprogname(), err->msg); got_privsep_send_error(&ibuf, err); } } + imsgbuf_clear(&ibuf); if (close(GOT_IMSG_FD_CHILD) == -1 && err == NULL) err = got_error_from_errno("close"); return err ? 1 : 0; blob - 5fc036bc57573c9e17ab302b84edcfad28d83b01 blob + d822239702f0cb31d5d90a0204548fe0fa3b2568 --- libexec/got-read-gotconfig/got-read-gotconfig.c +++ libexec/got-read-gotconfig/got-read-gotconfig.c @@ -607,13 +607,13 @@ main(int argc, char *argv[]) break; } - imsgbuf_clear(&ibuf); if (err) { if (!sigint_received && err->code != GOT_ERR_PRIVSEP_PIPE) { fprintf(stderr, "%s: %s\n", getprogname(), err->msg); got_privsep_send_error(&ibuf, err); } } + imsgbuf_clear(&ibuf); if (close(GOT_IMSG_FD_CHILD) == -1 && err == NULL) err = got_error_from_errno("close"); return err ? 1 : 0; blob - 4a4d2db38f1cd8a82995d5703ac44ec29f4edacc blob + c07a5ff401924255c9d023166671137b5e6a6fb7 --- libexec/got-read-object/got-read-object.c +++ libexec/got-read-object/got-read-object.c @@ -208,13 +208,13 @@ done: break; } - imsgbuf_clear(&ibuf); if (err) { if(!sigint_received && err->code != GOT_ERR_PRIVSEP_PIPE) { fprintf(stderr, "%s: %s\n", getprogname(), err->msg); got_privsep_send_error(&ibuf, err); } } + imsgbuf_clear(&ibuf); if (close(GOT_IMSG_FD_CHILD) == -1 && err == NULL) err = got_error_from_errno("close"); return err ? 1 : 0; blob - a4f3b4fb3382a935b01f5eab1734eec5dc9d1259 blob + 3193a744382b165f03043d74461855f87708c68a --- libexec/got-read-pack/got-read-pack.c +++ libexec/got-read-pack/got-read-pack.c @@ -2146,7 +2146,6 @@ main(int argc, char *argv[]) if (pack) got_pack_close(pack); got_object_cache_close(&objcache); - imsgbuf_clear(&ibuf); if (basefile && fclose(basefile) == EOF && err == NULL) err = got_error_from_errno("fclose"); if (accumfile && fclose(accumfile) == EOF && err == NULL) @@ -2159,6 +2158,7 @@ main(int argc, char *argv[]) got_privsep_send_error(&ibuf, err); } } + imsgbuf_clear(&ibuf); if (close(GOT_IMSG_FD_CHILD) == -1 && err == NULL) err = got_error_from_errno("close"); return err ? 1 : 0; blob - e9423888bbee99416b1a6b394a4268bbee9d2d4f blob + 96f50a833ebb41149d9ed5e07e3e91e0b90cf2ba --- libexec/got-read-tag/got-read-tag.c +++ libexec/got-read-tag/got-read-tag.c @@ -127,13 +127,13 @@ done: break; } - imsgbuf_clear(&ibuf); if (err) { if (!sigint_received && err->code != GOT_ERR_PRIVSEP_PIPE) { fprintf(stderr, "%s: %s\n", getprogname(), err->msg); got_privsep_send_error(&ibuf, err); } } + imsgbuf_clear(&ibuf); if (close(GOT_IMSG_FD_CHILD) == -1 && err == NULL) err = got_error_from_errno("close"); return err ? 1 : 0; blob - 40092a0767a00fe66a6806fbb3a29f08e99ce38b blob + ebf6949188e7f189d1ca4bf3eb6652f668d4f96c --- libexec/got-read-tree/got-read-tree.c +++ libexec/got-read-tree/got-read-tree.c @@ -133,13 +133,13 @@ done: } free(entries); - imsgbuf_clear(&ibuf); if (err) { if (!sigint_received && err->code != GOT_ERR_PRIVSEP_PIPE) { fprintf(stderr, "%s: %s\n", getprogname(), err->msg); got_privsep_send_error(&ibuf, err); } } + imsgbuf_clear(&ibuf); if (close(GOT_IMSG_FD_CHILD) == -1 && err == NULL) err = got_error_from_errno("close"); return err ? 1 : 0;