Use msgbuf_init() instead of hand initalizing the msgbuf.
authorclaudio <claudio@openbsd.org>
Mon, 9 Sep 2024 12:59:49 +0000 (12:59 +0000)
committerclaudio <claudio@openbsd.org>
Mon, 9 Sep 2024 12:59:49 +0000 (12:59 +0000)
OK tb@

usr.sbin/bgpd/rde.c
usr.sbin/bgpd/session.c

index d72afb2..4a28472 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: rde.c,v 1.629 2024/08/28 13:21:39 claudio Exp $ */
+/*     $OpenBSD: rde.c,v 1.630 2024/09/09 12:59:49 claudio Exp $ */
 
 /*
  * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -3199,7 +3199,7 @@ rde_dump_mrt_new(struct mrt *mrt, pid_t pid, int fd)
                return;
        }
        memcpy(&ctx->mrt, mrt, sizeof(struct mrt));
-       TAILQ_INIT(&ctx->mrt.wbuf.bufs);
+       msgbuf_init(&ctx->mrt.wbuf);
        ctx->mrt.wbuf.fd = fd;
        ctx->mrt.state = MRT_STATE_RUNNING;
        rid = rib_find(ctx->mrt.rib);
index 9548fe1..c176edb 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: session.c,v 1.481 2024/08/20 11:59:39 claudio Exp $ */
+/*     $OpenBSD: session.c,v 1.482 2024/09/09 12:59:49 claudio Exp $ */
 
 /*
  * Copyright (c) 2003, 2004, 2005 Henning Brauer <henning@openbsd.org>
@@ -3159,13 +3159,13 @@ session_dispatch_imsg(struct imsgbuf *imsgbuf, int idx, u_int *listener_cnt)
                                if (mrt == NULL)
                                        fatal("session_dispatch_imsg");
                                memcpy(mrt, &xmrt, sizeof(struct mrt));
-                               TAILQ_INIT(&mrt->wbuf.bufs);
+                               msgbuf_init(&mrt->wbuf);
                                LIST_INSERT_HEAD(&mrthead, mrt, entry);
                        } else {
                                /* old dump reopened */
                                close(mrt->wbuf.fd);
-                               mrt->wbuf.fd = xmrt.wbuf.fd;
                        }
+                       mrt->wbuf.fd = xmrt.wbuf.fd;
                        break;
                case IMSG_MRT_CLOSE:
                        if (idx != PFD_PIPE_MAIN)