From: Mark Jamsek Subject: fix stale error messages from imsg API conversion To: gameoftrees@openbsd.org Date: Sun, 08 Dec 2024 16:27:10 +1100 As per the subject: I stumbled upon one by chance so decided to grep the codebase and found a few more. All changes are in got_error_*() char * arguments except for one change in the privsep API documentation where a couple sentences were merged and reflowed in lib/got_lib_privsep.h. commit 2fd1eb98cab73b3b13a5cec27b7189bed8280188 from: Mark Jamsek date: Sun Dec 8 04:57:47 2024 UTC fix stale error messages left after imsg API conversion s/imsg_(flush|read)/imsgbuf_\1/g in got_error*() arguments and comment docs. M gotd/auth.c | 1+ 1- M gotd/gotd.c | 5+ 5- M gotd/imsg.c | 1+ 1- M gotd/listen.c | 1+ 1- M gotd/notify.c | 2+ 2- M gotd/repo_read.c | 2+ 2- M gotd/repo_write.c | 2+ 2- M gotd/session_read.c | 2+ 2- M gotd/session_write.c | 3+ 3- M gotwebd/config.c | 1+ 1- M gotwebd/gotwebd.c | 2+ 2- M gotwebd/sockets.c | 1+ 1- M lib/got_lib_privsep.h | 3+ 3- M lib/privsep.c | 2+ 2- 14 files changed, 28 insertions(+), 28 deletions(-) commit - d7b3c41a880c19dd469156f7a5ee6736ab94f428 commit + 2fd1eb98cab73b3b13a5cec27b7189bed8280188 blob - d553e9560b4c02da94cd93934d81447fe7120a4b blob + 41f6842f800bb0722d2303a4924d74865b6d1fba --- gotd/auth.c +++ gotd/auth.c @@ -253,7 +253,7 @@ auth_dispatch(int fd, short event, void *arg) if (event & EV_READ) { if ((n = imsgbuf_read(ibuf)) == -1) - fatal("imsg_read error"); + fatal("imsgbuf_read error"); if (n == 0) /* Connection closed. */ shut = 1; } blob - 03d8a3567b8ca2ae7126fba4812e92f0f2c9f7d9 blob + aef6a5bf630cbb2dc67c5c4ce03dac901228ce3e --- gotd/gotd.c +++ gotd/gotd.c @@ -1058,7 +1058,7 @@ gotd_dispatch_listener(int fd, short event, void *arg) if (event & EV_READ) { if ((n = imsgbuf_read(ibuf)) == -1) - fatal("imsg_read error"); + fatal("imsgbuf_read error"); if (n == 0) { /* Connection closed. */ shut = 1; @@ -1141,7 +1141,7 @@ gotd_dispatch_notifier(int fd, short event, void *arg) if (event & EV_READ) { if ((n = imsgbuf_read(ibuf)) == -1) - fatal("imsg_read error"); + fatal("imsgbuf_read error"); if (n == 0) { /* Connection closed. */ shut = 1; @@ -1215,7 +1215,7 @@ gotd_dispatch_auth_child(int fd, short event, void *ar if (event & EV_READ) { if ((n = imsgbuf_read(ibuf)) == -1) - fatal("imsg_read error"); + fatal("imsgbuf_read error"); if (n == 0) { /* Connection closed. */ shut = 1; @@ -1386,7 +1386,7 @@ gotd_dispatch_client_session(int fd, short event, void if (event & EV_READ) { if ((n = imsgbuf_read(ibuf)) == -1) - fatal("imsg_read error"); + fatal("imsgbuf_read error"); if (n == 0) { /* Connection closed. */ shut = 1; @@ -1543,7 +1543,7 @@ gotd_dispatch_repo_child(int fd, short event, void *ar if (event & EV_READ) { if ((n = imsgbuf_read(ibuf)) == -1) - fatal("imsg_read error"); + fatal("imsgbuf_read error"); if (n == 0) { /* Connection closed. */ shut = 1; blob - 8f7135ea7cd76db65c82d0b130b297e813130fb0 blob + d0c3603547caa4335b08553a55a7113dfc613d21 --- gotd/imsg.c +++ gotd/imsg.c @@ -88,7 +88,7 @@ gotd_imsg_recv(struct imsg *imsg, struct imsgbuf *ibuf if (n == 0) { n = imsgbuf_read(ibuf); if (n == -1) - return got_error_from_errno("imsg_read"); + return got_error_from_errno("imsgbuf_read"); if (n == 0) return got_error(GOT_ERR_EOF); n = imsg_get(ibuf, imsg); blob - bfd6bbf7fbb49725e8fc97d249263d3bab769903 blob + 5dab7072d9c805c4247a01452c85875d4639f46e --- gotd/listen.c +++ gotd/listen.c @@ -395,7 +395,7 @@ listen_dispatch(int fd, short event, void *arg) if (event & EV_READ) { if ((n = imsgbuf_read(ibuf)) == -1) - fatal("imsg_read error"); + fatal("imsgbuf_read error"); if (n == 0) /* Connection closed. */ shut = 1; } blob - 918d5245f9276afb922afaffb8650b0b74366238 blob + 06d2cc9fd0ad2425d121572c4f877ca2c3fd1832 --- gotd/notify.c +++ gotd/notify.c @@ -383,7 +383,7 @@ notify_dispatch_session(int fd, short event, void *arg if (event & EV_READ) { if ((n = imsgbuf_read(ibuf)) == -1) - fatal("imsg_read error"); + fatal("imsgbuf_read error"); if (n == 0) { /* Connection closed. */ shut = 1; @@ -517,7 +517,7 @@ notify_dispatch(int fd, short event, void *arg) if (event & EV_READ) { if ((n = imsgbuf_read(imsgbuf)) == -1) - fatal("imsg_read error"); + fatal("imsgbuf_read error"); if (n == 0) { /* Connection closed. */ shut = 1; blob - e0ce4b14263c87ffadab937db6475f3c27f5b726 blob + f44eb26f2a6197c25f2795391a684fce6ef79b29 --- gotd/repo_read.c +++ gotd/repo_read.c @@ -688,7 +688,7 @@ repo_read_dispatch_session(int fd, short event, void * if (event & EV_READ) { if ((n = imsgbuf_read(ibuf)) == -1) - fatal("imsg_read error"); + fatal("imsgbuf_read error"); if (n == 0) /* Connection closed. */ shut = 1; } @@ -809,7 +809,7 @@ repo_read_dispatch(int fd, short event, void *arg) if (event & EV_READ) { if ((n = imsgbuf_read(ibuf)) == -1) - fatal("imsg_read error"); + fatal("imsgbuf_read error"); if (n == 0) /* Connection closed. */ shut = 1; } blob - 3671b677adb0d7b91ccc4ee66f0bf4efdcbb0fa1 blob + 00881c209db0d54b36e0c566e676b5446387618e --- gotd/repo_write.c +++ gotd/repo_write.c @@ -2175,7 +2175,7 @@ repo_write_dispatch_session(int fd, short event, void if (event & EV_READ) { if ((n = imsgbuf_read(ibuf)) == -1) - fatal("imsg_read error"); + fatal("imsgbuf_read error"); if (n == 0) /* Connection closed. */ shut = 1; } @@ -2331,7 +2331,7 @@ repo_write_dispatch(int fd, short event, void *arg) if (event & EV_READ) { if ((n = imsgbuf_read(ibuf)) == -1) - fatal("imsg_read error"); + fatal("imsgbuf_read error"); if (n == 0) { /* Connection closed. */ shut = 1; goto done; blob - 08488403d28781f88b745596e03646c72fb388fb blob + f52eb058111051a61a5c7424d7c40c928859452a --- gotd/session_read.c +++ gotd/session_read.c @@ -206,7 +206,7 @@ session_dispatch_repo_child(int fd, short event, void if (event & EV_READ) { if ((n = imsgbuf_read(ibuf)) == -1) - fatal("imsg_read error"); + fatal("imsgbuf_read error"); if (n == 0) { /* Connection closed. */ shut = 1; @@ -749,7 +749,7 @@ session_dispatch(int fd, short event, void *arg) if (event & EV_READ) { if ((n = imsgbuf_read(ibuf)) == -1) - fatal("imsg_read error"); + fatal("imsgbuf_read error"); if (n == 0) { /* Connection closed. */ shut = 1; blob - 6ea223e8dbf5ff36609bc2f37074e75adcddf733 blob + ce6a68ae4e3613742b57a1c5fafd1978318f2ff5 --- gotd/session_write.c +++ gotd/session_write.c @@ -873,7 +873,7 @@ session_dispatch_repo_child(int fd, short event, void if (event & EV_READ) { if ((n = imsgbuf_read(ibuf)) == -1) - fatal("imsg_read error"); + fatal("imsgbuf_read error"); if (n == 0) { /* Connection closed. */ shut = 1; @@ -1448,7 +1448,7 @@ session_dispatch_notifier(int fd, short event, void *a if (event & EV_READ) { if ((n = imsgbuf_read(ibuf)) == -1) - fatal("imsg_read error"); + fatal("imsgbuf_read error"); if (n == 0) { /* Connection closed. */ shut = 1; @@ -1604,7 +1604,7 @@ session_dispatch(int fd, short event, void *arg) if (event & EV_READ) { if ((n = imsgbuf_read(ibuf)) == -1) - fatal("imsg_read error"); + fatal("imsgbuf_read error"); if (n == 0) { /* Connection closed. */ shut = 1; blob - c5992e15779413a10bed882be8e302a360de28e6 blob + 4035f97632b4cd9544bf5566cc128d3ec4d8996f --- gotwebd/config.c +++ gotwebd/config.c @@ -177,7 +177,7 @@ config_setfd(struct gotwebd *env) fatal("imsg_compose_event IMSG_CFG_FD"); if (imsgbuf_flush(&env->iev_server[j].ibuf) == -1) - fatal("imsg_flush"); + fatal("imsgbuf_flush"); imsg_event_add(&env->iev_server[j]); } } blob - ee7af401c35b0ddf92ce3dde4847b3bbac6ca1e2 blob + cf5ffeb4a5e53a4f171ff992a0ba3ce7061f50ed --- gotwebd/gotwebd.c +++ gotwebd/gotwebd.c @@ -142,13 +142,13 @@ gotwebd_dispatch_sockets(int fd, short event, void *ar if (event & EV_READ) { if ((n = imsgbuf_read(ibuf)) == -1) - fatal("imsg_read error"); + fatal("imsgbuf_read error"); if (n == 0) /* Connection closed */ shut = 1; } if (event & EV_WRITE) { if (imsgbuf_write(ibuf) == -1) - fatal("msgbuf_write"); + fatal("imsgbuf_write"); } for (;;) { blob - bf08e907f6aa6059cac714973e9dd139009154dc blob + f5b5815afdc9d9e4c386109e034b4aa2c9185842 --- gotwebd/sockets.c +++ gotwebd/sockets.c @@ -260,7 +260,7 @@ sockets_dispatch_main(int fd, short event, void *arg) if (event & EV_READ) { if ((n = imsgbuf_read(ibuf)) == -1) - fatal("imsg_read error"); + fatal("imsgbuf_read error"); if (n == 0) /* Connection closed */ shut = 1; } blob - 2a3413d75f8c6428f2b2737381dd72723b06f89a blob + de309e2be9e023e1af81a25efd0fb50d70776905 --- lib/got_lib_privsep.h +++ lib/got_lib_privsep.h @@ -16,9 +16,9 @@ */ /* - * All code runs under the same UID but sensitive code paths are - * run in a separate process with tighter pledge(2) promises. - * Data is communicated between processes via imsg_flush(3) and imsg_read(3). + * All code runs under the same UID but sensitive code paths are run in a + * separate process with tighter pledge(2) promises; data is communicated + * between processes via imsgbuf_flush(3) and imsgbuf_read(3). * This behaviour is transparent to users of the library. * * We generally transmit data in imsg buffers, split across several messages blob - 64d704e994ba8ed1e51bc799989fa95c1b58c180 blob + 4d97f68370673cd0b8596deaab214d88a71a195b --- lib/privsep.c +++ lib/privsep.c @@ -183,7 +183,7 @@ got_privsep_send_error(struct imsgbuf *ibuf, const str ret = imsgbuf_flush(ibuf); if (ret == -1) { - fprintf(stderr, "%s: error %d \"%s\": imsg_flush: %s\n", + fprintf(stderr, "%s: error %d \"%s\": imsgbuf_flush: %s\n", getprogname(), err->code, err->msg, strerror(errno)); return; } @@ -199,7 +199,7 @@ flush_imsg(struct imsgbuf *ibuf) return err; if (imsgbuf_flush(ibuf) == -1) - return got_error_from_errno("imsg_flush"); + return got_error_from_errno("imsgbuf_flush"); return NULL; } -- Mark Jamsek GPG: F2FF 13DE 6A06 C471 CA80 E6E2 2930 DC66 86EE CF68