aboutsummaryrefslogtreecommitdiffstats
path: root/asterisk.c
diff options
context:
space:
mode:
authorbbryant <bbryant@f38db490-d61c-443f-a65b-d21fe96a405b>2007-06-27 20:43:53 +0000
committerbbryant <bbryant@f38db490-d61c-443f-a65b-d21fe96a405b>2007-06-27 20:43:53 +0000
commitb00bd94b184fb16a56c2b9fc7c698f0ffba8db37 (patch)
treed4ff584250c1fb6b1214c87721b51849ad2e71fe /asterisk.c
parentdb5d1b2c2886866582d249fb5736b5cb126df787 (diff)
Fixes 100% load when controlling terminal disappears.
Issue #9654, #10010 git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.2@72259 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'asterisk.c')
-rw-r--r--asterisk.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/asterisk.c b/asterisk.c
index 111dcf53d..c7acd0128 100644
--- a/asterisk.c
+++ b/asterisk.c
@@ -1816,6 +1816,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';
@@ -2457,6 +2460,10 @@ 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';
@@ -2481,5 +2488,6 @@ int main(int argc, char *argv[])
monitor_sig_flags(NULL);
+lostterm:
return 0;
}