From: yasuoka Date: Tue, 22 Jul 2014 02:02:59 +0000 (+0000) Subject: Handle msgbuf_write() returning EAGAIN. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=5d71a92083c3c77ca0df3caf1eceee5c023dcfad;p=openbsd Handle msgbuf_write() returning EAGAIN. from krw --- diff --git a/usr.sbin/npppctl/npppctl.c b/usr.sbin/npppctl/npppctl.c index 27d0489b641..6f75d825c19 100644 --- a/usr.sbin/npppctl/npppctl.c +++ b/usr.sbin/npppctl/npppctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: npppctl.c,v 1.3 2014/04/03 07:10:18 yasuoka Exp $ */ +/* $OpenBSD: npppctl.c,v 1.4 2014/07/22 02:02:59 yasuoka Exp $ */ /* * Copyright (c) 2012 Internet Initiative Japan Inc. @@ -511,7 +511,7 @@ imsg_wait_command_completion(void) int n; while (ctl_ibuf.w.queued) - if (msgbuf_write(&ctl_ibuf.w) < -1) + if (msgbuf_write(&ctl_ibuf.w) <= 0 && errno != EAGAIN) return (-1); do { if ((n = imsg_get(&ctl_ibuf, &ctl_imsg)) == -1) diff --git a/usr.sbin/npppd/npppd/control.c b/usr.sbin/npppd/npppd/control.c index 19746c4bd68..d7ce1b525d9 100644 --- a/usr.sbin/npppd/npppd/control.c +++ b/usr.sbin/npppd/npppd/control.c @@ -1,4 +1,4 @@ -/* $OpenBSD: control.c,v 1.1 2014/03/22 04:30:31 yasuoka Exp $ */ +/* $OpenBSD: control.c,v 1.2 2014/07/22 02:03:00 yasuoka Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer @@ -252,7 +252,7 @@ control_dispatch_imsg(int fd, short event, void *arg) if (event & EV_WRITE) { - if (msgbuf_write(&c->iev.ibuf.w) < 0) { + if (msgbuf_write(&c->iev.ibuf.w) <= 0 && errno != EAGAIN) { control_close(fd, cs); return; }