This diff addresses the remaining fallout from the libutil bump.

imsgbuf_get() does the same thing as the now removed imsg_get() except
that it doesn't have a special return value != -1, 0 and its return type
is an int, not a ssize_t.

None of these ports looks at this special value, so all the calls can
just be replaced.

diff --git a/audio/amused/patches/patch-amused_c 
b/audio/amused/patches/patch-amused_c
new file mode 100644
index 00000000000..f731758a4d7
--- /dev/null
+++ b/audio/amused/patches/patch-amused_c
@@ -0,0 +1,14 @@
+Index: amused.c
+--- amused.c.orig
++++ amused.c
+@@ -123,8 +123,8 @@ main_dispatch_player(int sig, int event, void *d)
+       }
+ 
+       for (;;) {
+-              if ((n = imsg_get(imsgbuf, &imsg)) == -1)
+-                      fatal("imsg_get");
++              if ((n = imsgbuf_get(imsgbuf, &imsg)) == -1)
++                      fatal("imsgbuf_get");
+               if (n == 0)     /* No more messages. */
+                       break;
+ 
diff --git a/audio/amused/patches/patch-control_c 
b/audio/amused/patches/patch-control_c
new file mode 100644
index 00000000000..988c138cb97
--- /dev/null
+++ b/audio/amused/patches/patch-control_c
@@ -0,0 +1,23 @@
+Index: control.c
+--- control.c.orig
++++ control.c
+@@ -279,8 +279,8 @@ control_dispatch_imsg(int fd, int event, void *bula)
+       struct imsg              imsg;
+       struct player_mode       mode;
+       struct player_seek       seek;
+-      ssize_t                  n, off;
+-      int                      type, all;
++      ssize_t                  off;
++      int                      n, type, all;
+ 
+       if ((c = control_connbyfd(fd)) == NULL) {
+               log_warnx("%s: fd %d: not found", __func__, fd);
+@@ -304,7 +304,7 @@ control_dispatch_imsg(int fd, int event, void *bula)
+       }
+ 
+       for (;;) {
+-              if ((n = imsg_get(imsgbuf, &imsg)) == -1) {
++              if ((n = imsgbuf_get(imsgbuf, &imsg)) == -1) {
+                       control_close(fd);
+                       return;
+               }
diff --git a/audio/amused/patches/patch-ctl_c b/audio/amused/patches/patch-ctl_c
new file mode 100644
index 00000000000..3e4c275f7cc
--- /dev/null
+++ b/audio/amused/patches/patch-ctl_c
@@ -0,0 +1,24 @@
+Index: ctl.c
+--- ctl.c.orig
++++ ctl.c
+@@ -417,8 +417,7 @@ ctlaction(struct parse_result *res)
+       struct imsg imsg;
+       struct player_status ps;
+       struct player_event ev;
+-      ssize_t n;
+-      int i, type, ret = 0, done = 1;
++      int i, n, type, ret = 0, done = 1;
+ 
+       if (pledge("stdio", NULL) == -1)
+               fatal("pledge");
+@@ -544,8 +543,8 @@ ctlaction(struct parse_result *res)
+                       fatalx("pipe closed");
+ 
+               while (!done) {
+-                      if ((n = imsg_get(imsgbuf, &imsg)) == -1)
+-                              fatalx("imsg_get error");
++                      if ((n = imsgbuf_get(imsgbuf, &imsg)) == -1)
++                              fatalx("imsgbuf_get error");
+                       if (n == 0)
+                               break;
+ 
diff --git a/audio/amused/patches/patch-mpris2_mpris2_c 
b/audio/amused/patches/patch-mpris2_mpris2_c
new file mode 100644
index 00000000000..cf6a8c6535a
--- /dev/null
+++ b/audio/amused/patches/patch-mpris2_mpris2_c
@@ -0,0 +1,23 @@
+Index: mpris2/mpris2.c
+--- mpris2/mpris2.c.orig
++++ mpris2/mpris2.c
+@@ -456,7 +456,7 @@ imsg_dispatch(GIOChannel *chan, GIOCondition cond, gpo
+       struct imsg              imsg;
+       struct ibuf              ibuf;
+       struct player_event      event;
+-      ssize_t                  n;
++      int                      n;
+       size_t                   datalen;
+       const char              *msg;
+       char                     sha1buf[SHA1_DIGEST_STRING_LENGTH];
+@@ -467,8 +467,8 @@ imsg_dispatch(GIOChannel *chan, GIOCondition cond, gpo
+               fatalx("pipe closed");
+ 
+       for (;;) {
+-              if ((n = imsg_get(imsgbuf, &imsg)) == -1)
+-                      fatal("imsg_get");
++              if ((n = imsgbuf_get(imsgbuf, &imsg)) == -1)
++                      fatal("imsgbuf_get");
+               if (n == 0)
+                       break;
+ 
diff --git a/audio/amused/patches/patch-player_c 
b/audio/amused/patches/patch-player_c
new file mode 100644
index 00000000000..0cca2f46a5c
--- /dev/null
+++ b/audio/amused/patches/patch-player_c
@@ -0,0 +1,22 @@
+Index: player.c
+--- player.c.orig
++++ player.c
+@@ -114,15 +114,14 @@ player_dispatch(int64_t *s, int wait)
+       struct player_seek seek;
+       struct pollfd   pfd;
+       struct imsg     imsg;
+-      ssize_t         n;
+-      int             ret;
++      int             n, ret;
+ 
+       if (halted != 0)
+               return IMSG_STOP;
+ 
+ again:
+-      if ((n = imsg_get(imsgbuf, &imsg)) == -1)
+-              fatal("imsg_get");
++      if ((n = imsgbuf_get(imsgbuf, &imsg)) == -1)
++              fatal("imsgbuf_get");
+       if (n == 0) {
+               if (!wait)
+                       return -1;
diff --git a/audio/amused/patches/patch-web_web_c 
b/audio/amused/patches/patch-web_web_c
new file mode 100644
index 00000000000..aecca1d8dea
--- /dev/null
+++ b/audio/amused/patches/patch-web_web_c
@@ -0,0 +1,25 @@
+Index: web/web.c
+--- web/web.c.orig
++++ web/web.c
+@@ -470,9 +470,8 @@ imsg_dispatch(int fd, int ev, void *d)
+       struct player_status     ps;
+       struct player_event      event;
+       const char              *msg;
+-      ssize_t                  n;
+       size_t                   datalen;
+-      int                      r;
++      int                      n, r;
+ 
+       if (ev & EV_READ) {
+               if ((n = imsgbuf_read(&imsgbuf)) == -1)
+@@ -486,8 +485,8 @@ imsg_dispatch(int fd, int ev, void *d)
+       }
+ 
+       for (;;) {
+-              if ((n = imsg_get(&imsgbuf, &imsg)) == -1)
+-                      fatal("imsg_get");
++              if ((n = imsgbuf_get(&imsgbuf, &imsg)) == -1)
++                      fatal("imsgbuf_get");
+               if (n == 0)
+                       break;
+ 
diff --git a/net/gelatod/patches/patch-frontend_c 
b/net/gelatod/patches/patch-frontend_c
new file mode 100644
index 00000000000..9cf6e33b7ce
--- /dev/null
+++ b/net/gelatod/patches/patch-frontend_c
@@ -0,0 +1,24 @@
+Index: frontend.c
+--- frontend.c.orig
++++ frontend.c
+@@ -364,8 +364,7 @@ frontend_dispatch_main(int fd, short event, void *bula
+       struct imsg              imsg;
+       struct imsgev           *iev = bula;
+       struct imsgbuf          *ibuf = &iev->ibuf;
+-      ssize_t                  n;
+-      int                      shut = 0;
++      int                      n, shut = 0;
+ 
+       if (event & EV_READ) {
+               if ((n = imsgbuf_read(ibuf)) == -1)
+@@ -383,8 +382,8 @@ frontend_dispatch_main(int fd, short event, void *bula
+       }
+ 
+       for (;;) {
+-              if ((n = imsg_get(ibuf, &imsg)) == -1)
+-                      fatal("%s: imsg_get error", __func__);
++              if ((n = imsgbuf_get(ibuf, &imsg)) == -1)
++                      fatal("%s: imsgbuf_get error", __func__);
+               if (n == 0)     /* No more messages. */
+                       break;
+ 
diff --git a/net/gelatod/patches/patch-gelatod_c 
b/net/gelatod/patches/patch-gelatod_c
new file mode 100644
index 00000000000..d1281d0b667
--- /dev/null
+++ b/net/gelatod/patches/patch-gelatod_c
@@ -0,0 +1,24 @@
+Index: gelatod.c
+--- gelatod.c.orig
++++ gelatod.c
+@@ -308,8 +308,7 @@ main_dispatch_frontend(int fd, short event, void *bula
+       struct imsgbuf          *ibuf;
+       struct imsg              imsg;
+       struct clat_imsg         clat_imsg;
+-      ssize_t                  n;
+-      int                      shut = 0;
++      int                      n, shut = 0;
+ 
+       ibuf = &iev->ibuf;
+ 
+@@ -329,8 +328,8 @@ main_dispatch_frontend(int fd, short event, void *bula
+       }
+ 
+       for (;;) {
+-              if ((n = imsg_get(ibuf, &imsg)) == -1)
+-                      fatal("imsg_get");
++              if ((n = imsgbuf_get(ibuf, &imsg)) == -1)
++                      fatal("imsgbuf_get");
+               if (n == 0)     /* No more messages. */
+                       break;
+ 
diff --git a/net/openmdns/patches/patch-libmdns_mdnsl_c 
b/net/openmdns/patches/patch-libmdns_mdnsl_c
index 78f9ca156b8..1476464a468 100644
--- a/net/openmdns/patches/patch-libmdns_mdnsl_c
+++ b/net/openmdns/patches/patch-libmdns_mdnsl_c
@@ -22,7 +22,16 @@ Index: libmdns/mdnsl.c
  }
  
  void
-@@ -329,7 +330,7 @@ mdns_read(struct mdns *m)
+@@ -321,21 +322,20 @@ mdns_service_init(struct mdns_service *ms, const char 
+ ssize_t
+ mdns_read(struct mdns *m)
+ {
+-      int                     ev;
+-      size_t                  r;
++      int                     ev, r;
+       ssize_t                 n;
+       struct imsg             imsg;
+       struct rr               rr;
        struct mdns_service     ms;
        char                    groupname[MAXHOSTNAMELEN];
  
@@ -31,7 +40,14 @@ Index: libmdns/mdnsl.c
  
        if (n == -1 || n == 0)
                return (n);
-@@ -514,7 +515,7 @@ ibuf_send_imsg(struct imsgbuf *ibuf, u_int32_t type,
+ 
+       /* TODO call imsgctl_to_event() */
+-      while ((r = imsg_get(&m->ibuf, &imsg)) > 0) {
++      while ((r = imsgbuf_get(&m->ibuf, &imsg)) > 0) {
+               switch (imsg.hdr.type) {
+               case IMSG_CTL_LOOKUP: /* FALLTHROUGH */
+               case IMSG_CTL_LOOKUP_FAILURE:
+@@ -514,7 +514,7 @@ ibuf_send_imsg(struct imsgbuf *ibuf, u_int32_t type,
  
        imsg_close(ibuf, wbuf);
  
diff --git a/net/openmdns/patches/patch-mdnsd_control_c 
b/net/openmdns/patches/patch-mdnsd_control_c
index 2231d58b848..aea465c3d6d 100644
--- a/net/openmdns/patches/patch-mdnsd_control_c
+++ b/net/openmdns/patches/patch-mdnsd_control_c
@@ -37,7 +37,16 @@ Index: mdnsd/control.c
        TAILQ_REMOVE(&ctl_conns, c, entry);
  
        event_del(&c->iev.ev);
-@@ -644,13 +651,13 @@ control_dispatch_imsg(int fd, short event, void *bula)
+@@ -636,7 +643,7 @@ control_dispatch_imsg(int fd, short event, void *bula)
+ {
+       struct ctl_conn *c;
+       struct imsg      imsg;
+-      ssize_t          n;
++      int              n;
+ 
+       if ((c = control_connbyfd(fd)) == NULL) {
+               log_warn("control_dispatch_imsg: fd %d: not found", fd);
+@@ -644,20 +651,20 @@ control_dispatch_imsg(int fd, short event, void *bula)
        }
  
        if (event & EV_READ) {
@@ -53,3 +62,11 @@ Index: mdnsd/control.c
                        control_close(fd);
                        return;
                }
+       }
+ 
+       for (;;) {
+-              if ((n = imsg_get(&c->iev.ibuf, &imsg)) == -1) {
++              if ((n = imsgbuf_get(&c->iev.ibuf, &imsg)) == -1) {
+                       control_close(fd);
+                       return;
+               }
diff --git a/net/pfresolved/patches/patch-control_c 
b/net/pfresolved/patches/patch-control_c
index 0f2fb8d24e5..167a1b20c80 100644
--- a/net/pfresolved/patches/patch-control_c
+++ b/net/pfresolved/patches/patch-control_c
@@ -23,7 +23,7 @@ Index: control.c
        TAILQ_REMOVE(&ctl_conns, c, entry);
  
        event_del(&c->iev.ev);
-@@ -247,14 +251,13 @@ control_dispatch_imsg(int fd, short event, void *arg)
+@@ -247,21 +251,20 @@ control_dispatch_imsg(int fd, short event, void *arg)
        }
  
        if (event & EV_READ) {
@@ -40,3 +40,11 @@ Index: control.c
                        control_close(fd, cs);
                        return;
                }
+       }
+ 
+       for (;;) {
+-              if ((n = imsg_get(&c->iev.ibuf, &imsg)) == -1) {
++              if ((n = imsgbuf_get(&c->iev.ibuf, &imsg)) == -1) {
+                       control_close(fd, cs);
+                       return;
+               }
diff --git a/net/pfresolved/patches/patch-pfresolvectl_pfresolvectl_c 
b/net/pfresolved/patches/patch-pfresolvectl_pfresolvectl_c
index fedc9038ea2..4202c169acc 100644
--- a/net/pfresolved/patches/patch-pfresolvectl_pfresolvectl_c
+++ b/net/pfresolved/patches/patch-pfresolvectl_pfresolvectl_c
@@ -11,7 +11,7 @@ Index: pfresolvectl/pfresolvectl.c
  
        switch (res->action) {
        case NONE:
-@@ -113,14 +114,14 @@ main(int argc, char **argv)
+@@ -113,20 +114,20 @@ main(int argc, char **argv)
                break;
        }
  
@@ -31,3 +31,11 @@ Index: pfresolvectl/pfresolvectl.c
                if (n == 0)
                        errx(1, "%s: pipe closed", __func__);
  
+               while (!done) {
+-                      if ((n = imsg_get(ibuf, &imsg)) == -1)
+-                              errx(1, "%s: imsg_get error", __func__);
++                      if ((n = imsgbuf_get(ibuf, &imsg)) == -1)
++                              errx(1, "%s: imsgbuf_get error", __func__);
+                       if (n == 0)
+                               break;
+ 
diff --git a/net/pfresolved/patches/patch-proc_c 
b/net/pfresolved/patches/patch-proc_c
index c316b919498..a7486ff5e32 100644
--- a/net/pfresolved/patches/patch-proc_c
+++ b/net/pfresolved/patches/patch-proc_c
@@ -33,7 +33,17 @@ Index: proc.c
                        close(pp->pp_pipes[dst][n]);
                        pp->pp_pipes[dst][n] = -1;
                }
-@@ -753,8 +758,8 @@ proc_dispatch(int fd, short event, void *arg)
+@@ -744,8 +749,7 @@ proc_dispatch(int fd, short event, void *arg)
+       struct privsep          *ps = p->p_ps;
+       struct imsgbuf          *ibuf;
+       struct imsg              imsg;
+-      ssize_t                  n;
+-      int                      verbose;
++      int                      n, verbose;
+       const char              *title;
+       struct privsep_fd        pf;
+ 
+@@ -753,8 +757,8 @@ proc_dispatch(int fd, short event, void *arg)
        ibuf = &iev->ibuf;
  
        if (event & EV_READ) {
@@ -44,7 +54,7 @@ Index: proc.c
                if (n == 0) {
                        /* this pipe is dead, so remove the event handler */
                        event_del(&iev->ev);
-@@ -764,13 +769,14 @@ proc_dispatch(int fd, short event, void *arg)
+@@ -764,19 +768,20 @@ proc_dispatch(int fd, short event, void *arg)
        }
  
        if (event & EV_WRITE) {
@@ -66,7 +76,15 @@ Index: proc.c
                }
        }
  
-@@ -807,7 +813,7 @@ proc_dispatch(int fd, short event, void *arg)
+       for (;;) {
+-              if ((n = imsg_get(ibuf, &imsg)) == -1)
+-                      fatal("%s: imsg_get", __func__);
++              if ((n = imsgbuf_get(ibuf, &imsg)) == -1)
++                      fatal("%s: imsgbuf_get", __func__);
+               if (n == 0)
+                       break;
+ 
+@@ -807,7 +812,7 @@ proc_dispatch(int fd, short event, void *arg)
                case IMSG_CTL_PROCFD:
                        IMSG_SIZE_CHECK(&imsg, &pf);
                        memcpy(&pf, imsg.data, sizeof(pf));
@@ -75,7 +93,7 @@ Index: proc.c
                            pf.pf_instance);
                        break;
                default:
-@@ -836,12 +842,12 @@ void
+@@ -836,12 +841,12 @@ void
  imsg_event_add(struct imsgev *iev)
  {
        if (iev->handler == NULL) {
@@ -90,7 +108,7 @@ Index: proc.c
                iev->events |= EV_WRITE;
  
        event_del(&iev->ev);
-@@ -941,7 +947,8 @@ proc_forward_imsg(struct privsep *ps, struct imsg *ims
+@@ -941,7 +946,8 @@ proc_forward_imsg(struct privsep *ps, struct imsg *ims
      enum privsep_procid id, int n)
  {
        return (proc_compose_imsg(ps, id, n, imsg->hdr.type,
@@ -100,7 +118,7 @@ Index: proc.c
  }
  
  struct imsgbuf *
-@@ -974,7 +981,7 @@ proc_flush_imsg(struct privsep *ps, enum privsep_proci
+@@ -974,7 +980,7 @@ proc_flush_imsg(struct privsep *ps, enum privsep_proci
                if ((ibuf = proc_ibuf(ps, id, n)) == NULL)
                        return (-1);
                do {
diff --git a/net/telescope/patches/patch-control_c 
b/net/telescope/patches/patch-control_c
new file mode 100644
index 00000000000..ac2676a1ea4
--- /dev/null
+++ b/net/telescope/patches/patch-control_c
@@ -0,0 +1,21 @@
+Index: control.c
+--- control.c.orig
++++ control.c
+@@ -231,7 +231,7 @@ control_dispatch_imsg(int fd, int event, void *bula)
+ {
+       struct ctl_conn *c;
+       struct imsg      imsg;
+-      ssize_t          n;
++      int              n;
+ 
+       if ((c = control_connbyfd(fd)) == NULL) {
+               message("%s: fd %d: not found", __func__, fd);
+@@ -252,7 +252,7 @@ control_dispatch_imsg(int fd, int event, void *bula)
+       }
+ 
+       for (;;) {
+-              if ((n = imsg_get(&c->iev.ibuf, &imsg)) == -1) {
++              if ((n = imsgbuf_get(&c->iev.ibuf, &imsg)) == -1) {
+                       control_close(fd);
+                       return;
+               }
diff --git a/net/telescope/patches/patch-net_c 
b/net/telescope/patches/patch-net_c
new file mode 100644
index 00000000000..31c63ca3239
--- /dev/null
+++ b/net/telescope/patches/patch-net_c
@@ -0,0 +1,24 @@
+Index: net.c
+--- net.c.orig
++++ net.c
+@@ -576,8 +576,7 @@ handle_dispatch_imsg(int fd, int event, void *d)
+       struct imsg      imsg;
+       struct req      *req;
+       struct get_req   r;
+-      ssize_t          n;
+-      int              certok;
++      int              certok, n;
+ 
+       if (event & EV_READ) {
+               if (imsgbuf_read(ibuf) == -1) {
+@@ -593,8 +592,8 @@ handle_dispatch_imsg(int fd, int event, void *d)
+       }
+ 
+       for (;;) {
+-              if ((n = imsg_get(ibuf, &imsg)) == -1)
+-                      err(1, "imsg_get");
++              if ((n = imsgbuf_get(ibuf, &imsg)) == -1)
++                      err(1, "imsgbuf_get");
+               if (n == 0)
+                       break;
+               switch (imsg_get_type(&imsg)) {
diff --git a/net/telescope/patches/patch-telescope_c 
b/net/telescope/patches/patch-telescope_c
new file mode 100644
index 00000000000..84cda796a29
--- /dev/null
+++ b/net/telescope/patches/patch-telescope_c
@@ -0,0 +1,24 @@
+Index: telescope.c
+--- telescope.c.orig
++++ telescope.c
+@@ -453,8 +453,7 @@ handle_dispatch_imsg(int fd, int event, void *data)
+       struct download *d;
+       const char      *h;
+       char            *str, *page;
+-      ssize_t          n;
+-      int              code;
++      int              code, n;
+ 
+       if (event & EV_READ) {
+               if (imsgbuf_read(imsgbuf) == -1)
+@@ -466,8 +465,8 @@ handle_dispatch_imsg(int fd, int event, void *data)
+       }
+ 
+       for (;;) {
+-              if ((n = imsg_get(imsgbuf, &imsg)) == -1)
+-                      err(1, "imsg_get");
++              if ((n = imsgbuf_get(imsgbuf, &imsg)) == -1)
++                      err(1, "imsgbuf_get");
+               if (n == 0)
+                       break;
+ 
diff --git a/net/thingsd/patches/patch-thingsctl_thingsctl_c 
b/net/thingsd/patches/patch-thingsctl_thingsctl_c
index c16f1c8cc44..ce1845194e9 100644
--- a/net/thingsd/patches/patch-thingsctl_thingsctl_c
+++ b/net/thingsd/patches/patch-thingsctl_thingsctl_c
@@ -27,6 +27,17 @@ Index: thingsctl/thingsctl.c
                        errx(1, "imsg_read error");
                if (n == 0) {
                        if (res->action == SHOW_PACKETS)
+@@ -202,8 +202,8 @@ main(int argc, char *argv[])
+               }
+ 
+               while (!done) {
+-                      if ((n = imsg_get(ibuf, &imsg)) == -1)
+-                              errx(1, "imsg_get error");
++                      if ((n = imsgbuf_get(ibuf, &imsg)) == -1)
++                              errx(1, "imsgbuf_get error");
+                       if (n == 0)
+                               break;
+ 
 @@ -226,7 +226,7 @@ main(int argc, char *argv[])
                                        done = 1;
                                        break;
diff --git a/net/thingsd/patches/patch-thingsd_control_c 
b/net/thingsd/patches/patch-thingsd_control_c
index 5b646fa1b76..f8d47201058 100644
--- a/net/thingsd/patches/patch-thingsd_control_c
+++ b/net/thingsd/patches/patch-thingsd_control_c
@@ -24,7 +24,7 @@ Index: thingsd/control.c
        TAILQ_REMOVE(&ctl_conns, c, entry);
  
        event_del(&c->iev.ev);
-@@ -397,15 +402,15 @@ control_dispatch_imsg(int fd, short event, void *arg)
+@@ -397,22 +402,22 @@ control_dispatch_imsg(int fd, short event, void *arg)
        }
  
        if (event & EV_READ) {
@@ -43,6 +43,14 @@ Index: thingsd/control.c
                        control_close(ps, &imsg, fd, cs);
                        return;
                }
+       }
+ 
+       for (;;) {
+-              n = imsg_get(&c->iev.ibuf, &imsg);
++              n = imsgbuf_get(&c->iev.ibuf, &imsg);
+               if (n == -1) {
+                       control_close(ps, &imsg, fd, cs);
+                       return;
 @@ -505,7 +510,7 @@ control_dispatch_imsg(int fd, short event, void *arg)
  fail:
        imsg_compose_event(&c->iev, IMSG_CTL_FAIL,
diff --git a/net/thingsd/patches/patch-thingsd_proc_c 
b/net/thingsd/patches/patch-thingsd_proc_c
index b3a529d04df..2cd903c74ec 100644
--- a/net/thingsd/patches/patch-thingsd_proc_c
+++ b/net/thingsd/patches/patch-thingsd_proc_c
@@ -33,7 +33,17 @@ Index: thingsd/proc.c
                        close(pp->pp_pipes[dst][n]);
                        pp->pp_pipes[dst][n] = -1;
                }
-@@ -625,7 +630,7 @@ proc_dispatch(int fd, short event, void *arg)
+@@ -616,8 +621,7 @@ proc_dispatch(int fd, short event, void *arg)
+       struct privsep          *ps = p->p_ps;
+       struct imsgbuf          *ibuf;
+       struct imsg              imsg;
+-      ssize_t                  n;
+-      int                      verbose;
++      int                      n, verbose;
+       const char              *title;
+       struct privsep_fd        pf;
+ 
+@@ -625,7 +629,7 @@ proc_dispatch(int fd, short event, void *arg)
        ibuf = &iev->ibuf;
  
        if (event & EV_READ) {
@@ -42,7 +52,7 @@ Index: thingsd/proc.c
                        fatal("%s: imsg_read", __func__);
                if (n == 0) {
                        /* this pipe is dead, so remove the event handler */
-@@ -636,13 +641,14 @@ proc_dispatch(int fd, short event, void *arg)
+@@ -636,19 +640,20 @@ proc_dispatch(int fd, short event, void *arg)
        }
  
        if (event & EV_WRITE) {
@@ -63,7 +73,15 @@ Index: thingsd/proc.c
                }
        }
  
-@@ -679,7 +685,7 @@ proc_dispatch(int fd, short event, void *arg)
+       for (;;) {
+-              if ((n = imsg_get(ibuf, &imsg)) == -1)
+-                      fatal("%s: imsg_get", __func__);
++              if ((n = imsgbuf_get(ibuf, &imsg)) == -1)
++                      fatal("%s: imsgbuf_get", __func__);
+               if (n == 0)
+                       break;
+ 
+@@ -679,7 +684,7 @@ proc_dispatch(int fd, short event, void *arg)
                case IMSG_CTL_PROCFD:
                        IMSG_SIZE_CHECK(&imsg, &pf);
                        memcpy(&pf, imsg.data, sizeof(pf));
@@ -72,7 +90,7 @@ Index: thingsd/proc.c
                            pf.pf_instance);
                        break;
                default:
-@@ -712,12 +718,12 @@ void
+@@ -712,12 +717,12 @@ void
  imsg_event_add(struct imsgev *iev)
  {
        if (iev->handler == NULL) {
@@ -87,7 +105,7 @@ Index: thingsd/proc.c
                iev->events |= EV_WRITE;
  
        event_del(&iev->ev);
-@@ -814,7 +820,8 @@ proc_forward_imsg(struct privsep *ps, struct imsg *ims
+@@ -814,7 +819,8 @@ proc_forward_imsg(struct privsep *ps, struct imsg *ims
      enum privsep_procid id, int n)
  {
        return (proc_compose_imsg(ps, id, n, imsg->hdr.type,
@@ -97,7 +115,7 @@ Index: thingsd/proc.c
  }
  
  struct imsgbuf *
-@@ -847,7 +854,7 @@ proc_flush_imsg(struct privsep *ps, enum privsep_proci
+@@ -847,7 +853,7 @@ proc_flush_imsg(struct privsep *ps, enum privsep_proci
                if ((ibuf = proc_ibuf(ps, id, n)) == NULL)
                        return (-1);
                do {

Reply via email to