aboutsummaryrefslogtreecommitdiffstats
path: root/apps/app_festival.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/app_festival.c')
-rw-r--r--apps/app_festival.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/apps/app_festival.c b/apps/app_festival.c
index 03753642c..186a50ae7 100644
--- a/apps/app_festival.c
+++ b/apps/app_festival.c
@@ -455,8 +455,20 @@ static int festival_exec(struct ast_channel *chan, void *vdata)
/* This assumes only one waveform will come back, also LP is unlikely */
wave = 0;
do {
+ int read_data;
for (n=0; n < 3; )
- n += read(fd,ack+n,3-n);
+ {
+ read_data = read(fd,ack+n,3-n);
+ /* this avoids falling in infinite loop
+ * in case that festival server goes down
+ * */
+ if ( read_data == -1 )
+ {
+ ast_log(LOG_WARNING,"Unable to read from cache/festival fd");
+ return -1;
+ }
+ n += read_data;
+ }
ack[3] = '\0';
if (strcmp(ack,"WV\n") == 0) { /* receive a waveform */
ast_log(LOG_DEBUG,"Festival WV command\n");