Handle msgbuf_write() returning EAGAIN.
authoryasuoka <yasuoka@openbsd.org>
Tue, 22 Jul 2014 02:02:59 +0000 (02:02 +0000)
committeryasuoka <yasuoka@openbsd.org>
Tue, 22 Jul 2014 02:02:59 +0000 (02:02 +0000)
from krw

usr.sbin/npppctl/npppctl.c
usr.sbin/npppd/npppd/control.c

index 27d0489..6f75d82 100644 (file)
@@ -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)
index 19746c4..d7ce1b5 100644 (file)
@@ -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 <henning@openbsd.org>
@@ -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;
                }