commit b861c60c7ca955d7dd5c12f192dba80578fee400 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 - 67dcc610aece88139668be12f4ecb5db915d1252 commit + b861c60c7ca955d7dd5c12f192dba80578fee400 blob - 600e2c02a45902c21891d50646205887049d4dbc blob + ba4c708156713a3772a13a7b3f3416fb240c5591 --- 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;