summaryrefslogtreecommitdiff
path: root/apps/app_festival.c
diff options
context:
space:
mode:
authorKevin P. Fleming <kpfleming@digium.com>2008-11-02 18:52:13 +0000
committerKevin P. Fleming <kpfleming@digium.com>2008-11-02 18:52:13 +0000
commitbd4eb070f3b292617be20bda069cac47df2f7495 (patch)
treea3750d996d41e35c5df34c29533dd7d9fdcaff24 /apps/app_festival.c
parent1e6864dd9d894db29ebc350b015e9eb58226a021 (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: https://origsvn.digium.com/svn/asterisk/trunk@153616 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'apps/app_festival.c')
-rw-r--r--apps/app_festival.c27
1 files changed, 21 insertions, 6 deletions
diff --git a/apps/app_festival.c b/apps/app_festival.c
index 82f1bddc5..2d57a51dc 100644
--- a/apps/app_festival.c
+++ b/apps/app_festival.c
@@ -38,6 +38,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include <signal.h>
#include <fcntl.h>
#include <ctype.h>
+#include <errno.h>
#include "asterisk/file.h"
#include "asterisk/channel.h"
@@ -147,7 +148,11 @@ static int send_waveform_to_fd(char *waveform, int length, int fd)
*(waveform + x) = c;
}
#endif
- write(fd, waveform, length);
+
+ if (write(fd, waveform, length) < 0) {
+ ast_log(LOG_WARNING, "write() failed: %s\n", strerror(errno));
+ }
+
close(fd);
exit(0);
}
@@ -424,17 +429,25 @@ static int festival_exec(struct ast_channel *chan, void *vdata)
writecache = 1;
strln = strlen(args.text);
ast_debug(1, "line length : %d\n", strln);
- write(fdesc, &strln, sizeof(strln));
- write(fdesc, args.text, strln);
+ if (write(fdesc,&strln,sizeof(int)) < 0) {
+ ast_log(LOG_WARNING, "write() failed: %s\n", strerror(errno));
+ }
+ if (write(fdesc,data,strln) < 0) {
+ ast_log(LOG_WARNING, "write() failed: %s\n", strerror(errno));
+ }
seekpos = lseek(fdesc, 0, SEEK_CUR);
ast_debug(1, "Seek position : %d\n", seekpos);
}
} else {
- read(fdesc, &strln, sizeof(strln));
+ if (read(fdesc,&strln,sizeof(int)) != sizeof(int)) {
+ ast_log(LOG_WARNING, "read() failed: %s\n", strerror(errno));
+ }
ast_debug(1, "Cache file exists, strln=%d, strlen=%d\n", strln, (int)strlen(args.text));
if (strlen(args.text) == strln) {
ast_debug(1, "Size OK\n");
- read(fdesc, &bigstring, strln);
+ if (read(fdesc,&bigstring,strln) != strln) {
+ ast_log(LOG_WARNING, "read() failed: %s\n", strerror(errno));
+ }
bigstring[strln] = 0;
if (strcmp(bigstring, args.text) == 0) {
readcache = 1;
@@ -464,7 +477,9 @@ static int festival_exec(struct ast_channel *chan, void *vdata)
if (writecache == 1) {
ast_debug(1, "Writing result to cache...\n");
while ((strln = read(fd, buffer, 16384)) != 0) {
- write(fdesc, buffer, strln);
+ if (write(fdesc,buffer,strln) < 0) {
+ ast_log(LOG_WARNING, "write() failed: %s\n", strerror(errno));
+ }
}
close(fd);
close(fdesc);