aboutsummaryrefslogtreecommitdiffstats
path: root/asterisk.c
diff options
context:
space:
mode:
authorbbryant <bbryant@f38db490-d61c-443f-a65b-d21fe96a405b>2007-06-27 23:22:13 +0000
committerbbryant <bbryant@f38db490-d61c-443f-a65b-d21fe96a405b>2007-06-27 23:22:13 +0000
commit7433bdc1c60c1e147d565ac8f91ee46af1f15297 (patch)
tree0ec524c71028ebce9a1b640eb11d6b9ef42a50af /asterisk.c
parent5cae098a849f888c7c229b784ba9b64f44e6dfb5 (diff)
Reinstating patch. This actually fixes the problem, however I was running a development branch without it and mistakenly thought it wasn't fixed.
Fixes issue #10010, and #9654: 100% CPU usage caused by an asterisk console losing it's controlling terminal. git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.2@72373 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'asterisk.c')
-rw-r--r--asterisk.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/asterisk.c b/asterisk.c
index 707cce811..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';
@@ -2458,6 +2461,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';
@@ -2482,5 +2488,6 @@ int main(int argc, char *argv[])
monitor_sig_flags(NULL);
+lostterm:
return 0;
}