All pastes #274921 Raw Edit

patch for Juggie

public text v1 · immutable
·published 2006-12-11 02:15 UTC
rendered paste body
Index: res/res_agi.c
===================================================================
--- res/res_agi.c       (revision 48374)
+++ res/res_agi.c       (working copy)
@@ -1914,6 +1914,15 @@
                                pid = -1;
                                break;
                        }
+                       while (!strchr(buf, '\n')) {
+                               char *ret = fgets(buf + strlen(buf), sizeof(buf) - strlen(buf), readf);
+                               /* EAGAIN doesn't return NULL, so only real errors trigger this */
+                               if (ret == NULL)
+                                       break;
+                               /* Max buf size, but no newline */
+                               if (strlen(buf) == sizeof(buf) - 1)
+                                       break;
+                       }
                        /* get rid of trailing newline, if any */
                        if (*buf && buf[strlen(buf) - 1] == '\n')
                                buf[strlen(buf) - 1] = 0;