diff options
Diffstat (limited to 'apps')
-rw-r--r-- | apps/app_adsiprog.c | 4 | ||||
-rw-r--r-- | apps/app_authenticate.c | 4 | ||||
-rw-r--r-- | apps/app_chanspy.c | 8 | ||||
-rw-r--r-- | apps/app_dial.c | 10 | ||||
-rw-r--r-- | apps/app_festival.c | 27 | ||||
-rw-r--r-- | apps/app_queue.c | 10 | ||||
-rw-r--r-- | apps/app_sms.c | 4 | ||||
-rw-r--r-- | apps/app_stack.c | 10 | ||||
-rw-r--r-- | apps/app_voicemail.c | 4 |
9 files changed, 63 insertions, 18 deletions
diff --git a/apps/app_adsiprog.c b/apps/app_adsiprog.c index 63be6bf06..0a22cae41 100644 --- a/apps/app_adsiprog.c +++ b/apps/app_adsiprog.c @@ -1369,7 +1369,9 @@ static struct adsi_script *compile_script(char *script) /* Create "main" as first subroutine */ getsubbyname(scr, "main", NULL, 0); while (!feof(f)) { - fgets(buf, sizeof(buf), f); + if (!fgets(buf, sizeof(buf), f)) { + continue; + } if (!feof(f)) { lineno++; /* Trim off trailing return */ diff --git a/apps/app_authenticate.c b/apps/app_authenticate.c index 8e1919594..e746c6511 100644 --- a/apps/app_authenticate.c +++ b/apps/app_authenticate.c @@ -151,7 +151,9 @@ static int auth_exec(struct ast_channel *chan, void *data) if (feof(f)) break; - fgets(buf, sizeof(buf), f); + if (!fgets(buf, sizeof(buf), f)) { + continue; + } if (ast_strlen_zero(buf)) continue; diff --git a/apps/app_chanspy.c b/apps/app_chanspy.c index 9d606ec7b..0a0972b41 100644 --- a/apps/app_chanspy.c +++ b/apps/app_chanspy.c @@ -34,6 +34,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") #include <ctype.h> +#include <errno.h> #include "asterisk/paths.h" /* use ast_config_AST_MONITOR_DIR */ #include "asterisk/file.h" @@ -212,8 +213,11 @@ static int spy_generate(struct ast_channel *chan, void *data, int len, int sampl return -1; } - if (csth->fd) - write(csth->fd, f->data, f->datalen); + if (csth->fd) { + if (write(csth->fd, f->data, f->datalen) < 0) { + ast_log(LOG_WARNING, "write() failed: %s\n", strerror(errno)); + } + } ast_frfree(f); diff --git a/apps/app_dial.c b/apps/app_dial.c index fa98e4633..25776c0f4 100644 --- a/apps/app_dial.c +++ b/apps/app_dial.c @@ -1762,10 +1762,16 @@ static int dial_exec_full(struct ast_channel *chan, void *data, struct ast_flags gosub_argstart = strchr(opt_args[OPT_ARG_CALLEE_GOSUB], ','); if (gosub_argstart) { *gosub_argstart = 0; - asprintf(&gosub_args, "%s,s,1(%s)", opt_args[OPT_ARG_CALLEE_GOSUB], gosub_argstart + 1); + if (asprintf(&gosub_args, "%s,s,1(%s)", opt_args[OPT_ARG_CALLEE_GOSUB], gosub_argstart + 1) < 0) { + ast_log(LOG_WARNING, "asprintf() failed: %s\n", strerror(errno)); + gosub_args = NULL; + } *gosub_argstart = ','; } else { - asprintf(&gosub_args, "%s,s,1", opt_args[OPT_ARG_CALLEE_GOSUB]); + if (asprintf(&gosub_args, "%s,s,1", opt_args[OPT_ARG_CALLEE_GOSUB]) < 0) { + ast_log(LOG_WARNING, "asprintf() failed: %s\n", strerror(errno)); + gosub_args = NULL; + } } if (gosub_args) { diff --git a/apps/app_festival.c b/apps/app_festival.c index e788291ed..4e1e47e8a 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" @@ -148,7 +149,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); } @@ -421,17 +426,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; @@ -461,7 +474,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); diff --git a/apps/app_queue.c b/apps/app_queue.c index 66c0bb614..7f7f0db4a 100644 --- a/apps/app_queue.c +++ b/apps/app_queue.c @@ -3750,10 +3750,16 @@ static int try_calling(struct queue_ent *qe, const char *options, char *announce gosub_argstart = strchr(gosubexec, ','); if (gosub_argstart) { *gosub_argstart = 0; - asprintf(&gosub_args, "%s,s,1(%s)", gosubexec, gosub_argstart + 1); + if (asprintf(&gosub_args, "%s,s,1(%s)", gosubexec, gosub_argstart + 1) < 0) { + ast_log(LOG_WARNING, "asprintf() failed: %s\n", strerror(errno)); + gosub_args = NULL; + } *gosub_argstart = '|'; } else { - asprintf(&gosub_args, "%s,s,1", gosubexec); + if (asprintf(&gosub_args, "%s,s,1", gosubexec) < 0) { + ast_log(LOG_WARNING, "asprintf() failed: %s\n", strerror(errno)); + gosub_args = NULL; + } } if (gosub_args) { res = pbx_exec(qe->chan, app, gosub_args); diff --git a/apps/app_sms.c b/apps/app_sms.c index 3f5211f1d..a11244fc9 100644 --- a/apps/app_sms.c +++ b/apps/app_sms.c @@ -745,7 +745,9 @@ static void sms_log(sms_t * h, char status) } *p++ = '\n'; *p = 0; - write(o, line, strlen(line)); + if (write(o, line, strlen(line)) < 0) { + ast_log(LOG_WARNING, "write() failed: %s\n", strerror(errno)); + } close(o); } *h->oa = *h->da = h->udl = 0; diff --git a/apps/app_stack.c b/apps/app_stack.c index f452f8de2..e3b9a5280 100644 --- a/apps/app_stack.c +++ b/apps/app_stack.c @@ -426,9 +426,15 @@ static int handle_gosub(struct ast_channel *chan, AGI *agi, int argc, char **arg * call a Gosub for the CALLEE channel in Dial or Queue. */ if (argc == 5) { - asprintf(&gosub_args, "%s,%s,%d(%s)", argv[1], argv[2], priority + 1, argv[4]); + if (asprintf(&gosub_args, "%s,%s,%d(%s)", argv[1], argv[2], priority + 1, argv[4]) < 0) { + ast_log(LOG_WARNING, "asprintf() failed: %s\n", strerror(errno)); + gosub_args = NULL; + } } else { - asprintf(&gosub_args, "%s,%s,%d", argv[1], argv[2], priority + 1); + if (asprintf(&gosub_args, "%s,%s,%d", argv[1], argv[2], priority + 1) < 0) { + ast_log(LOG_WARNING, "asprintf() failed: %s\n", strerror(errno)); + gosub_args = NULL; + } } if (gosub_args) { diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c index 5eff1c324..2af30be52 100644 --- a/apps/app_voicemail.c +++ b/apps/app_voicemail.c @@ -4771,7 +4771,9 @@ static int has_voicemail(const char *mailbox, const char *folder) f = fopen(fn2, "r"); if (f) { while (!feof(f)) { - fgets((char *)buf, sizeof(buf), f); + if (!fgets((char *)buf, sizeof(buf), f)) { + continue; + } if (!feof(f)) { char *stringp = NULL; stringp = (char *)buf; |