commit 5400b2df83f1447d73ff30ed10d04cf1d2a78b1e from: Stefan Sperling via: Thomas Adam date: Tue Jul 22 08:17:38 2025 UTC fix 'gotctl reload -s secrets' failing once gotd has failed to reload once Reset reload secrets state on reload failure, such that the next reload attempt will not be rejected with an 'unexpected imsg' error. commit - d8c5a49979cbd72335d978f164c33aae604754d6 commit + 5400b2df83f1447d73ff30ed10d04cf1d2a78b1e blob - 51f4552080c86a3a3c66e26213112cfe6c0ca58b blob + 70889e25ecfc220858913785552e9a1c82bae160 --- gotd/gotd.c +++ gotd/gotd.c @@ -651,6 +651,17 @@ halt_listener(struct gotd_imsgev *iev) } static void +reload_reset(void) +{ + /* Clear state such that reloading again will work. */ + close(gotd_reload_conf_fd); + gotd_reload_conf_fd = -1; + close(gotd_reload_secrets_fd); + gotd_reload_secrets_fd = -1; + have_reload_secrets = 0; +} + +static void gotd_dispatch_reload(int fd, short event, void *arg) { const struct got_error *err = NULL; @@ -711,6 +722,7 @@ gotd_dispatch_reload(int fd, short event, void *arg) kill_proc(gotd.reload_proc, 0); gotd.reload_proc = NULL; imsg_free(&imsg); + reload_reset(); return; } @@ -3743,12 +3755,7 @@ main(int argc, char **argv) imsgbuf_clear(&ibuf); close(GOTD_FILENO_MSG_PIPE); - /* Clear state such that reloading again will work. */ - close(gotd_reload_conf_fd); - gotd_reload_conf_fd = -1; - close(gotd_reload_secrets_fd); - gotd_reload_secrets_fd = -1; - have_reload_secrets = 0; + reload_reset(); } gotd.argv0 = argv0;