proc: consume all data after the pipe dies, instead of looping with 100% cpu usage
authorFelix Fietkau <nbd@openwrt.org>
Tue, 30 Jul 2013 22:32:40 +0000 (00:32 +0200)
committerFelix Fietkau <nbd@openwrt.org>
Tue, 30 Jul 2013 22:32:40 +0000 (00:32 +0200)
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
proc.c

diff --git a/proc.c b/proc.c
index 67356dd766ef7b76d35883800236a04399d221a1..5be6232e79849843ef6d1422af3a29a3a683aee0 100644 (file)
--- a/proc.c
+++ b/proc.c
@@ -282,9 +282,8 @@ static int proc_data_send(struct client *cl, const char *data, int len)
                        if (errno == EAGAIN || errno == EWOULDBLOCK)
                                break;
 
-                       /* error, no retry */
-                       len = 0;
-                       break;
+                       /* consume all data */
+                       ret = len;
                }
 
                if (!ret)