diff options
author | kpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-11-02 18:52:13 +0000 |
---|---|---|
committer | kpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-11-02 18:52:13 +0000 |
commit | cc1b2c100fc6dd44a690652ecd3c5788b0438ea7 (patch) | |
tree | a3750d996d41e35c5df34c29533dd7d9fdcaff24 /agi/eagi-sphinx-test.c | |
parent | 2d6e969e7c81afb0b050691b85f2bc74ca84ae62 (diff) |
bring over all the fixes for the warnings found by gcc 4.3.x from the 1.4 branch, and add the ones needed for all the new code here too
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@153616 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'agi/eagi-sphinx-test.c')
-rw-r--r-- | agi/eagi-sphinx-test.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/agi/eagi-sphinx-test.c b/agi/eagi-sphinx-test.c index d2898763c..4d13db507 100644 --- a/agi/eagi-sphinx-test.c +++ b/agi/eagi-sphinx-test.c @@ -79,7 +79,9 @@ static int read_environment(void) char *val; /* Read environment */ for(;;) { - fgets(buf, sizeof(buf), stdin); + if (!fgets(buf, sizeof(buf), stdin)) { + return -1; + } if (feof(stdin)) return -1; buf[strlen(buf) - 1] = '\0'; @@ -130,7 +132,9 @@ static char *wait_result(void) return NULL; } if (FD_ISSET(STDIN_FILENO, &fds)) { - fgets(astresp, sizeof(astresp), stdin); + if (!fgets(astresp, sizeof(astresp), stdin)) { + return NULL; + } if (feof(stdin)) { fprintf(stderr, "Got hungup on apparently\n"); return NULL; @@ -141,9 +145,10 @@ static char *wait_result(void) } if (FD_ISSET(AUDIO_FILENO, &fds)) { res = read(AUDIO_FILENO, audiobuf, sizeof(audiobuf)); - if (res > 0) { - if (sphinx_sock > -1) - write(sphinx_sock, audiobuf, res); + if ((res > 0) && (sphinx_sock > -1)) { + if (write(sphinx_sock, audiobuf, res) < 0) { + fprintf(stderr, "write() failed: %s\n", strerror(errno)); + } } } if ((sphinx_sock > -1) && FD_ISSET(sphinx_sock, &fds)) { |