summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/bgpctl/bgpctl.c13
-rw-r--r--usr.sbin/dhcp6leasectl/dhcp6leasectl.c13
-rw-r--r--usr.sbin/dhcpleasectl/dhcpleasectl.c13
-rw-r--r--usr.sbin/dvmrpctl/dvmrpctl.c7
-rw-r--r--usr.sbin/eigrpctl/eigrpctl.c7
-rw-r--r--usr.sbin/ikectl/ikectl.c7
-rw-r--r--usr.sbin/ldapctl/ldapctl.c7
-rw-r--r--usr.sbin/ldpctl/ldpctl.c7
-rw-r--r--usr.sbin/npppctl/npppctl.c7
-rw-r--r--usr.sbin/ntpd/ntpd.c7
-rw-r--r--usr.sbin/ospf6ctl/ospf6ctl.c7
-rw-r--r--usr.sbin/ospfctl/ospfctl.c7
-rw-r--r--usr.sbin/ractl/ractl.c7
-rw-r--r--usr.sbin/radiusctl/radiusctl.c8
-rw-r--r--usr.sbin/relayctl/relayctl.c7
-rw-r--r--usr.sbin/ripctl/ripctl.c7
-rw-r--r--usr.sbin/slaacctl/slaacctl.c7
-rw-r--r--usr.sbin/smtpd/enqueue.c7
-rw-r--r--usr.sbin/unwindctl/unwindctl.c7
-rw-r--r--usr.sbin/vmctl/main.c7
20 files changed, 66 insertions, 93 deletions
diff --git a/usr.sbin/bgpctl/bgpctl.c b/usr.sbin/bgpctl/bgpctl.c
index d8becf6f808..d4446660287 100644
--- a/usr.sbin/bgpctl/bgpctl.c
+++ b/usr.sbin/bgpctl/bgpctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bgpctl.c,v 1.307 2024/08/14 19:10:51 claudio Exp $ */
+/* $OpenBSD: bgpctl.c,v 1.308 2024/11/21 13:08:32 claudio Exp $ */
/*
* Copyright (c) 2003 Henning Brauer <henning@openbsd.org>
@@ -418,9 +418,8 @@ main(int argc, char *argv[])
output->head(res);
again:
- while (imsgbuf->w.queued)
- if (msgbuf_write(&imsgbuf->w) <= 0)
- err(1, "write error");
+ if (imsg_flush(imsgbuf) == -1)
+ err(1, "write error");
while (!done) {
while (!done) {
@@ -1384,10 +1383,8 @@ network_mrt_dump(struct mrt_rib *mr, struct mrt_peer *mp, void *arg)
mre->attrs[j].attr, mre->attrs[j].attr_len);
imsg_compose(imsgbuf, IMSG_NETWORK_DONE, 0, 0, -1, NULL, 0);
- while (imsgbuf->w.queued) {
- if (msgbuf_write(&imsgbuf->w) <= 0 && errno != EAGAIN)
- err(1, "write error");
- }
+ if (imsg_flush(imsgbuf) == -1)
+ err(1, "write error");
}
}
diff --git a/usr.sbin/dhcp6leasectl/dhcp6leasectl.c b/usr.sbin/dhcp6leasectl/dhcp6leasectl.c
index 9398612e80d..a30cf64ae37 100644
--- a/usr.sbin/dhcp6leasectl/dhcp6leasectl.c
+++ b/usr.sbin/dhcp6leasectl/dhcp6leasectl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dhcp6leasectl.c,v 1.1 2024/06/06 15:16:57 florian Exp $ */
+/* $OpenBSD: dhcp6leasectl.c,v 1.2 2024/11/21 13:08:34 claudio Exp $ */
/*
* Copyright (c) 2021, 2024 Florian Obser <florian@openbsd.org>
@@ -127,9 +127,8 @@ main(int argc, char *argv[])
if (!lFlag) {
imsg_compose(ibuf, IMSG_CTL_SEND_REQUEST, 0, 0, -1,
&if_index, sizeof(if_index));
- while (ibuf->w.queued)
- if (msgbuf_write(&ibuf->w) <= 0 && errno != EAGAIN)
- err(1, "write error");
+ if (imsg_flush(ibuf) == -1)
+ err(1, "write error");
}
@@ -137,10 +136,8 @@ main(int argc, char *argv[])
imsg_compose(ibuf, IMSG_CTL_SHOW_INTERFACE_INFO, 0, 0, -1,
&if_index, sizeof(if_index));
- while (ibuf->w.queued)
- if (msgbuf_write(&ibuf->w) <= 0 && errno != EAGAIN)
- err(1, "write error");
-
+ if (imsg_flush(ibuf) == -1)
+ err(1, "write error");
if ((n = imsg_read(ibuf)) == -1 && errno != EAGAIN)
errx(1, "imsg_read error");
diff --git a/usr.sbin/dhcpleasectl/dhcpleasectl.c b/usr.sbin/dhcpleasectl/dhcpleasectl.c
index 6b2627785b4..8ca05e62b97 100644
--- a/usr.sbin/dhcpleasectl/dhcpleasectl.c
+++ b/usr.sbin/dhcpleasectl/dhcpleasectl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dhcpleasectl.c,v 1.8 2024/06/06 15:07:46 florian Exp $ */
+/* $OpenBSD: dhcpleasectl.c,v 1.9 2024/11/21 13:08:48 claudio Exp $ */
/*
* Copyright (c) 2021 Florian Obser <florian@openbsd.org>
@@ -161,9 +161,8 @@ main(int argc, char *argv[])
if (!lFlag) {
imsg_compose(ibuf, IMSG_CTL_SEND_REQUEST, 0, 0, -1,
&if_index, sizeof(if_index));
- while (ibuf->w.queued)
- if (msgbuf_write(&ibuf->w) <= 0 && errno != EAGAIN)
- err(1, "write error");
+ if (imsg_flush(ibuf) == -1)
+ err(1, "write error");
}
@@ -171,10 +170,8 @@ main(int argc, char *argv[])
imsg_compose(ibuf, IMSG_CTL_SHOW_INTERFACE_INFO, 0, 0, -1,
&if_index, sizeof(if_index));
- while (ibuf->w.queued)
- if (msgbuf_write(&ibuf->w) <= 0 && errno != EAGAIN)
- err(1, "write error");
-
+ if (imsg_flush(ibuf) == -1)
+ err(1, "write error");
if ((n = imsg_read(ibuf)) == -1 && errno != EAGAIN)
errx(1, "imsg_read error");
diff --git a/usr.sbin/dvmrpctl/dvmrpctl.c b/usr.sbin/dvmrpctl/dvmrpctl.c
index e805e77266b..fd8f3390d5b 100644
--- a/usr.sbin/dvmrpctl/dvmrpctl.c
+++ b/usr.sbin/dvmrpctl/dvmrpctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dvmrpctl.c,v 1.16 2022/01/20 14:10:07 naddy Exp $ */
+/* $OpenBSD: dvmrpctl.c,v 1.17 2024/11/21 13:08:50 claudio Exp $ */
/*
* Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org>
@@ -173,9 +173,8 @@ main(int argc, char *argv[])
break;
}
- while (ibuf->w.queued)
- if (msgbuf_write(&ibuf->w) <= 0 && errno != EAGAIN)
- err(1, "write error");
+ if (imsg_flush(ibuf) == -1)
+ err(1, "write error");
while (!done) {
if ((n = imsg_read(ibuf)) == -1 && errno != EAGAIN)
diff --git a/usr.sbin/eigrpctl/eigrpctl.c b/usr.sbin/eigrpctl/eigrpctl.c
index c7c4baa039e..80b6fde9e56 100644
--- a/usr.sbin/eigrpctl/eigrpctl.c
+++ b/usr.sbin/eigrpctl/eigrpctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: eigrpctl.c,v 1.9 2017/02/22 14:18:25 renato Exp $ */
+/* $OpenBSD: eigrpctl.c,v 1.10 2024/11/21 13:08:51 claudio Exp $ */
/*
* Copyright (c) 2015 Renato Westphal <renato@openbsd.org>
@@ -217,9 +217,8 @@ main(int argc, char *argv[])
break;
}
- while (ibuf->w.queued)
- if (msgbuf_write(&ibuf->w) <= 0 && errno != EAGAIN)
- err(1, "write error");
+ if (imsg_flush(ibuf) == -1)
+ err(1, "write error");
while (!done) {
if ((n = imsg_read(ibuf)) == -1 && errno != EAGAIN)
diff --git a/usr.sbin/ikectl/ikectl.c b/usr.sbin/ikectl/ikectl.c
index 5d496a84db3..785372fc6c6 100644
--- a/usr.sbin/ikectl/ikectl.c
+++ b/usr.sbin/ikectl/ikectl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ikectl.c,v 1.31 2024/05/21 05:00:48 jsg Exp $ */
+/* $OpenBSD: ikectl.c,v 1.32 2024/11/21 13:08:52 claudio Exp $ */
/*
* Copyright (c) 2007-2013 Reyk Floeter <reyk@openbsd.org>
@@ -339,9 +339,8 @@ main(int argc, char *argv[])
break;
}
- while (ibuf->w.queued)
- if (msgbuf_write(&ibuf->w) <= 0 && errno != EAGAIN)
- err(1, "write error");
+ if (imsg_flush(ibuf) == -1)
+ err(1, "write error");
while (!done) {
if ((n = imsg_read(ibuf)) == -1 && errno != EAGAIN)
diff --git a/usr.sbin/ldapctl/ldapctl.c b/usr.sbin/ldapctl/ldapctl.c
index db576852663..8c2271e3153 100644
--- a/usr.sbin/ldapctl/ldapctl.c
+++ b/usr.sbin/ldapctl/ldapctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ldapctl.c,v 1.16 2024/11/05 09:18:35 claudio Exp $ */
+/* $OpenBSD: ldapctl.c,v 1.17 2024/11/21 13:08:53 claudio Exp $ */
/*
* Copyright (c) 2009, 2010 Martin Hedenfalk <martin@bzero.se>
@@ -355,9 +355,8 @@ main(int argc, char *argv[])
fatal("internal error");
}
- while (ibuf.w.queued)
- if (msgbuf_write(&ibuf.w) <= 0 && errno != EAGAIN)
- err(1, "write error");
+ if (imsg_flush(&ibuf) == -1)
+ err(1, "write error");
while (!done) {
if ((n = imsg_read(&ibuf)) == -1 && errno != EAGAIN)
diff --git a/usr.sbin/ldpctl/ldpctl.c b/usr.sbin/ldpctl/ldpctl.c
index 9967b35836f..2d17f931ffd 100644
--- a/usr.sbin/ldpctl/ldpctl.c
+++ b/usr.sbin/ldpctl/ldpctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ldpctl.c,v 1.32 2016/07/15 17:09:25 renato Exp $
+/* $OpenBSD: ldpctl.c,v 1.33 2024/11/21 13:08:54 claudio Exp $
*
* Copyright (c) 2009 Michele Marchetto <michele@openbsd.org>
* Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org>
@@ -206,9 +206,8 @@ main(int argc, char *argv[])
break;
}
- while (ibuf->w.queued)
- if (msgbuf_write(&ibuf->w) <= 0 && errno != EAGAIN)
- err(1, "write error");
+ if (imsg_flush(ibuf) == -1)
+ err(1, "write error");
while (!done) {
if ((n = imsg_read(ibuf)) == -1 && errno != EAGAIN)
diff --git a/usr.sbin/npppctl/npppctl.c b/usr.sbin/npppctl/npppctl.c
index d873c26cf17..5860ddd9168 100644
--- a/usr.sbin/npppctl/npppctl.c
+++ b/usr.sbin/npppctl/npppctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: npppctl.c,v 1.11 2023/02/21 15:45:40 mbuhl Exp $ */
+/* $OpenBSD: npppctl.c,v 1.12 2024/11/21 13:08:55 claudio Exp $ */
/*
* Copyright (c) 2012 Internet Initiative Japan Inc.
@@ -509,9 +509,8 @@ imsg_wait_command_completion(void)
{
int n;
- while (ctl_ibuf.w.queued)
- if (msgbuf_write(&ctl_ibuf.w) <= 0 && errno != EAGAIN)
- return (-1);
+ if (imsg_flush(&ctl_ibuf) == -1)
+ return (-1);
do {
if ((n = imsg_get(&ctl_ibuf, &ctl_imsg)) == -1)
return (-1);
diff --git a/usr.sbin/ntpd/ntpd.c b/usr.sbin/ntpd/ntpd.c
index 7f81bb9be7f..e61092c400b 100644
--- a/usr.sbin/ntpd/ntpd.c
+++ b/usr.sbin/ntpd/ntpd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ntpd.c,v 1.133 2024/05/21 05:00:48 jsg Exp $ */
+/* $OpenBSD: ntpd.c,v 1.134 2024/11/21 13:08:56 claudio Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -694,9 +694,8 @@ ctl_main(int argc, char *argv[])
break; /* NOTREACHED */
}
- while (ibuf_ctl->w.queued)
- if (msgbuf_write(&ibuf_ctl->w) <= 0 && errno != EAGAIN)
- err(1, "ibuf_ctl: msgbuf_write error");
+ if (imsg_flush(ibuf_ctl) == -1)
+ err(1, "ibuf_ctl: imsg_flush error");
done = 0;
while (!done) {
diff --git a/usr.sbin/ospf6ctl/ospf6ctl.c b/usr.sbin/ospf6ctl/ospf6ctl.c
index 488ac927ea6..36bd6767076 100644
--- a/usr.sbin/ospf6ctl/ospf6ctl.c
+++ b/usr.sbin/ospf6ctl/ospf6ctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ospf6ctl.c,v 1.54 2023/06/21 09:47:03 sthen Exp $ */
+/* $OpenBSD: ospf6ctl.c,v 1.55 2024/11/21 13:08:57 claudio Exp $ */
/*
* Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org>
@@ -250,9 +250,8 @@ main(int argc, char *argv[])
#endif
}
- while (ibuf->w.queued)
- if (msgbuf_write(&ibuf->w) <= 0 && errno != EAGAIN)
- err(1, "write error");
+ if (imsg_flush(ibuf) == -1)
+ err(1, "write error");
while (!done) {
if ((n = imsg_read(ibuf)) == -1 && errno != EAGAIN)
diff --git a/usr.sbin/ospfctl/ospfctl.c b/usr.sbin/ospfctl/ospfctl.c
index e41f739c336..8d947e0313a 100644
--- a/usr.sbin/ospfctl/ospfctl.c
+++ b/usr.sbin/ospfctl/ospfctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ospfctl.c,v 1.68 2020/05/20 11:11:24 denis Exp $ */
+/* $OpenBSD: ospfctl.c,v 1.69 2024/11/21 13:08:58 claudio Exp $ */
/*
* Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org>
@@ -213,9 +213,8 @@ main(int argc, char *argv[])
break;
}
- while (ibuf->w.queued)
- if (msgbuf_write(&ibuf->w) <= 0 && errno != EAGAIN)
- err(1, "write error");
+ if (imsg_flush(ibuf) == -1)
+ err(1, "write error");
/* no output for certain commands such as log verbose */
if (!done) {
diff --git a/usr.sbin/ractl/ractl.c b/usr.sbin/ractl/ractl.c
index 39fefa4b8c3..146d44408be 100644
--- a/usr.sbin/ractl/ractl.c
+++ b/usr.sbin/ractl/ractl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ractl.c,v 1.3 2021/02/27 10:35:20 florian Exp $ */
+/* $OpenBSD: ractl.c,v 1.4 2024/11/21 13:08:59 claudio Exp $ */
/*
* Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org>
@@ -123,9 +123,8 @@ main(int argc, char *argv[])
usage();
}
- while (ibuf->w.queued)
- if (msgbuf_write(&ibuf->w) <= 0 && errno != EAGAIN)
- err(1, "write error");
+ if (imsg_flush(ibuf) == -1)
+ err(1, "write error");
while (!done) {
if ((n = imsg_read(ibuf)) == -1 && errno != EAGAIN)
diff --git a/usr.sbin/radiusctl/radiusctl.c b/usr.sbin/radiusctl/radiusctl.c
index 40fec84a223..8285db51f22 100644
--- a/usr.sbin/radiusctl/radiusctl.c
+++ b/usr.sbin/radiusctl/radiusctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: radiusctl.c,v 1.13 2024/09/15 05:26:05 yasuoka Exp $ */
+/* $OpenBSD: radiusctl.c,v 1.14 2024/11/21 13:09:00 claudio Exp $ */
/*
* Copyright (c) 2015 YASUOKA Masahiko <yasuoka@yasuoka.net>
*
@@ -185,10 +185,8 @@ main(int argc, char *argv[])
: IMSG_RADIUSD_MODULE_IPCP_DISCONNECT, 0, 0, -1, iov, niov);
break;
}
- while (ibuf.w.queued) {
- if (msgbuf_write(&ibuf.w) <= 0 && errno != EAGAIN)
- err(1, "ibuf_ctl: msgbuf_write error");
- }
+ if (imsg_flush(&ibuf) == -1)
+ err(1, "ibuf_ctl: imsg_flush error");
while (!done) {
if (((n = imsg_read(&ibuf)) == -1 && errno != EAGAIN) || n == 0)
break;
diff --git a/usr.sbin/relayctl/relayctl.c b/usr.sbin/relayctl/relayctl.c
index 83bacf05b94..69bc5595305 100644
--- a/usr.sbin/relayctl/relayctl.c
+++ b/usr.sbin/relayctl/relayctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: relayctl.c,v 1.58 2017/11/29 15:24:50 benno Exp $ */
+/* $OpenBSD: relayctl.c,v 1.59 2024/11/21 13:09:01 claudio Exp $ */
/*
* Copyright (c) 2007 - 2013 Reyk Floeter <reyk@openbsd.org>
@@ -221,9 +221,8 @@ main(int argc, char *argv[])
break;
}
- while (ibuf->w.queued)
- if (msgbuf_write(&ibuf->w) <= 0 && errno != EAGAIN)
- err(1, "write error");
+ if (imsg_flush(ibuf) == -1)
+ err(1, "write error");
while (!done) {
if ((n = imsg_read(ibuf)) == -1 && errno != EAGAIN)
diff --git a/usr.sbin/ripctl/ripctl.c b/usr.sbin/ripctl/ripctl.c
index 051f9cb206f..ab97ae2dfe0 100644
--- a/usr.sbin/ripctl/ripctl.c
+++ b/usr.sbin/ripctl/ripctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ripctl.c,v 1.17 2016/08/02 16:05:32 jca Exp $
+/* $OpenBSD: ripctl.c,v 1.18 2024/11/21 13:09:02 claudio Exp $
*
* Copyright (c) 2006 Michele Marchetto <mydecay@openbeer.it>
* Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org>
@@ -187,9 +187,8 @@ main(int argc, char *argv[])
break;
}
- while (ibuf->w.queued)
- if (msgbuf_write(&ibuf->w) <= 0 && errno != EAGAIN)
- err(1, "write error");
+ if (imsg_flush(ibuf) == -1)
+ err(1, "write error");
while (!done) {
if ((n = imsg_read(ibuf)) == -1 && errno != EAGAIN)
diff --git a/usr.sbin/slaacctl/slaacctl.c b/usr.sbin/slaacctl/slaacctl.c
index 6128785db2a..15904fb1409 100644
--- a/usr.sbin/slaacctl/slaacctl.c
+++ b/usr.sbin/slaacctl/slaacctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: slaacctl.c,v 1.23 2022/03/21 16:25:47 florian Exp $ */
+/* $OpenBSD: slaacctl.c,v 1.24 2024/11/21 13:09:03 claudio Exp $ */
/*
* Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org>
@@ -136,9 +136,8 @@ main(int argc, char *argv[])
usage();
}
- while (ibuf->w.queued)
- if (msgbuf_write(&ibuf->w) <= 0 && errno != EAGAIN)
- err(1, "write error");
+ if (imsg_flush(ibuf) == -1)
+ err(1, "write error");
while (!done) {
if ((n = imsg_read(ibuf)) == -1 && errno != EAGAIN)
diff --git a/usr.sbin/smtpd/enqueue.c b/usr.sbin/smtpd/enqueue.c
index 51616d0d590..d15838d2e62 100644
--- a/usr.sbin/smtpd/enqueue.c
+++ b/usr.sbin/smtpd/enqueue.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: enqueue.c,v 1.122 2024/01/20 09:01:03 claudio Exp $ */
+/* $OpenBSD: enqueue.c,v 1.123 2024/11/21 13:09:04 claudio Exp $ */
/*
* Copyright (c) 2005 Henning Brauer <henning@bulabula.org>
@@ -784,9 +784,8 @@ open_connection(void)
imsg_compose(ibuf, IMSG_CTL_SMTP_SESSION, IMSG_VERSION, 0, -1, NULL, 0);
- while (ibuf->w.queued)
- if (msgbuf_write(&ibuf->w) <= 0 && errno != EAGAIN)
- err(1, "write error");
+ if (imsg_flush(ibuf) == -1)
+ err(1, "write error");
while (1) {
if ((n = imsg_read(ibuf)) == -1 && errno != EAGAIN)
diff --git a/usr.sbin/unwindctl/unwindctl.c b/usr.sbin/unwindctl/unwindctl.c
index 3e64d6ad5a5..b6d5a919c9f 100644
--- a/usr.sbin/unwindctl/unwindctl.c
+++ b/usr.sbin/unwindctl/unwindctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: unwindctl.c,v 1.29 2021/11/10 20:24:22 bket Exp $ */
+/* $OpenBSD: unwindctl.c,v 1.30 2024/11/21 13:09:05 claudio Exp $ */
/*
* Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org>
@@ -177,9 +177,8 @@ main(int argc, char *argv[])
usage();
}
- while (ibuf->w.queued)
- if (msgbuf_write(&ibuf->w) <= 0 && errno != EAGAIN)
- err(1, "write error");
+ if (imsg_flush(ibuf) == -1)
+ err(1, "write error");
while (!done) {
if ((n = imsg_read(ibuf)) == -1 && errno != EAGAIN)
diff --git a/usr.sbin/vmctl/main.c b/usr.sbin/vmctl/main.c
index 0583ef953c8..7f13b033448 100644
--- a/usr.sbin/vmctl/main.c
+++ b/usr.sbin/vmctl/main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: main.c,v 1.79 2024/08/17 20:50:06 mlarkin Exp $ */
+/* $OpenBSD: main.c,v 1.80 2024/11/21 13:09:06 claudio Exp $ */
/*
* Copyright (c) 2015 Reyk Floeter <reyk@openbsd.org>
@@ -273,9 +273,8 @@ vmmaction(struct parse_result *res)
flags = res->flags;
parse_free(res);
- while (ibuf->w.queued)
- if (msgbuf_write(&ibuf->w) <= 0 && errno != EAGAIN)
- err(1, "write error");
+ if (imsg_flush(ibuf) == -1)
+ err(1, "write error");
while (!done) {
if ((n = imsg_read(ibuf)) == -1 && errno != EAGAIN)