commit 72a8aafe2138625f6cdd458c1b2929ecc7978c25d692c310fabc86ff0191e665 from: Stefan Sperling date: Tue Jun 24 07:32:03 2025 UTC make errors reported by gotsys-apply-conf actually visible Do not close the pipe to gotsysd before trying to send an error message to gotsysd. Print errors to stderr as a last resort. commit - c4edf8e81528e722835da5a16e06cb9954bfbc5016511691bec30c38fec7c84d commit + 72a8aafe2138625f6cdd458c1b2929ecc7978c25d692c310fabc86ff0191e665 blob - 239d2547701ccbc842e370d3bbfa0e248fa86ce94b715f1f9c14ad4f948871bb blob + 33c1f24300676577d309dc9dbe0d19b0f119aac7e351e99ee60ae5764994c5e4 --- gotsysd/libexec/gotsys-apply-conf/gotsys-apply-conf.c +++ gotsysd/libexec/gotsys-apply-conf/gotsys-apply-conf.c @@ -531,18 +531,20 @@ main(int argc, char *argv[]) done: free(confpath); free(secretspath); - if (close(GOTSYSD_FILENO_MSG_PIPE) == -1 && err == NULL) - err = got_error_from_errno("close"); if (conf_fd != -1 && close(conf_fd) == -1 && err == NULL) err = got_error_from_errno("close"); if (secrets_fd != -1 && close(secrets_fd) == -1 && err == NULL) - err = got_error_from_errno("close"); - if (err) + err = got_error_from_errno("close"); + if (err) { + fprintf(stderr, "%s: %s\n", getprogname(), err->msg); gotsysd_imsg_send_error(&gotsysd_iev.ibuf, 0, 0, err); + } if (gotsysd_iev.ibuf.fd != -1) imsgbuf_clear(&gotsysd_iev.ibuf); if (gotd_iev.ibuf.fd != -1) imsgbuf_clear(&gotd_iev.ibuf); + if (close(GOTSYSD_FILENO_MSG_PIPE) == -1 && err == NULL) + err = got_error_from_errno("close"); if (gotd_sock != -1 && close(gotd_sock) == -1 && err == NULL) err = got_error_from_errno("close"); return err ? 1 : 0;