1
0
mirror of https://github.com/openbsd/src.git synced 2025-01-03 06:45:37 -08:00

Convert npppd and npppctl over to new imsgbuf_read behaviour.

OK tb@
This commit is contained in:
claudio 2024-11-21 13:23:13 +00:00
parent 035f931039
commit ba4450f46b
3 changed files with 6 additions and 11 deletions

View File

@ -1,4 +1,4 @@
/* $OpenBSD: npppctl.c,v 1.13 2024/11/21 13:17:02 claudio Exp $ */
/* $OpenBSD: npppctl.c,v 1.14 2024/11/21 13:23:13 claudio Exp $ */
/*
* Copyright (c) 2012 Internet Initiative Japan Inc.
@ -516,8 +516,7 @@ imsg_wait_command_completion(void)
return (-1);
if (n != 0)
break;
if (((n = imsgbuf_read(&ctl_ibuf)) == -1 && errno != EAGAIN) ||
n == 0)
if (imsgbuf_read(&ctl_ibuf) != 1)
return (-1);
} while (1);

View File

@ -1,4 +1,4 @@
/* $OpenBSD: control.c,v 1.13 2024/11/21 13:18:38 claudio Exp $ */
/* $OpenBSD: control.c,v 1.14 2024/11/21 13:23:13 claudio Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@ -263,8 +263,7 @@ control_dispatch_imsg(int fd, short event, void *arg)
return;
}
if (event & EV_READ) {
if (((n = imsgbuf_read(&c->iev.ibuf)) == -1 &&
errno != EAGAIN) || n == 0) {
if (imsgbuf_read(&c->iev.ibuf) != 1) {
control_close(fd, cs);
return;
}

View File

@ -1,4 +1,4 @@
/* $OpenBSD: privsep.c,v 1.27 2024/11/21 13:17:02 claudio Exp $ */
/* $OpenBSD: privsep.c,v 1.28 2024/11/21 13:23:13 claudio Exp $ */
/*
* Copyright (c) 2010 Yasuoka Masahiko <yasuoka@openbsd.org>
@ -954,11 +954,8 @@ imsg_read_and_get(struct imsgbuf *ibuf, struct imsg *imsg)
ssize_t n;
for (;;) {
if ((n = imsgbuf_read(ibuf)) <= 0) {
if (n == -1 && (errno == EAGAIN || errno == EINTR))
continue;
if (imsgbuf_read(ibuf) != 1)
return (-1);
}
if ((n = imsg_get(ibuf, imsg)) < 0)
return (-1);
if (n == 0)