Merged revisions 72383 via svnmerge from
[asterisk/asterisk.git] / main / asterisk.c
index 6a826bf..eb5654a 100644 (file)
@@ -2232,6 +2232,9 @@ static void ast_remotecontrol(char * data)
        for (;;) {
                ebuf = (char *)el_gets(el, &num);
 
+               if (!ebuf && write(1, "", 1) < 0)
+                       break;
+
                if (!ast_strlen_zero(ebuf)) {
                        if (ebuf[strlen(ebuf)-1] == '\n')
                                ebuf[strlen(ebuf)-1] = '\0';
@@ -2958,6 +2961,9 @@ int main(int argc, char *argv[])
                for (;;) {
                        buf = (char *)el_gets(el, &num);
 
+                       if (!buf && write(1, "", 1) < 0)
+                               goto lostterm;
+
                        if (buf) {
                                if (buf[strlen(buf)-1] == '\n')
                                        buf[strlen(buf)-1] = '\0';
@@ -2980,5 +2986,6 @@ int main(int argc, char *argv[])
 
        monitor_sig_flags(NULL);
 
+lostterm:
        return 0;
 }