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 /apps | |
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 '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 | 8 |
9 files changed, 66 insertions, 19 deletions
diff --git a/apps/app_adsiprog.c b/apps/app_adsiprog.c index f35a81eea..126068c94 100644 --- a/apps/app_adsiprog.c +++ b/apps/app_adsiprog.c @@ -1379,7 +1379,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 10d0b2f73..69abf6f38 100644 --- a/apps/app_authenticate.c +++ b/apps/app_authenticate.c @@ -181,7 +181,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 86ad9e737..f4a5a5d81 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" @@ -374,8 +375,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.ptr, f->datalen); + if (csth->fd) { + if (write(csth->fd, f->data.ptr, 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 b918f23a5..a42edf7a0 100644 --- a/apps/app_dial.c +++ b/apps/app_dial.c @@ -2030,10 +2030,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 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); diff --git a/apps/app_queue.c b/apps/app_queue.c index bc04deb46..81e822355 100644 --- a/apps/app_queue.c +++ b/apps/app_queue.c @@ -3940,10 +3940,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, application, gosub_args); diff --git a/apps/app_sms.c b/apps/app_sms.c index 0a20c8b23..6c99ad37a 100644 --- a/apps/app_sms.c +++ b/apps/app_sms.c @@ -779,7 +779,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 599c5f1d4..714eaae2c 100644 --- a/apps/app_stack.c +++ b/apps/app_stack.c @@ -478,9 +478,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 617d31aa5..de08d99b3 100644 --- a/apps/app_voicemail.c +++ b/apps/app_voicemail.c @@ -867,7 +867,9 @@ static char *vm_check_password_shell(char *command, char *buf, size_t len) } else if (pid) { /* parent */ close(fds[1]); - read(fds[0], buf, len); + if (read(fds[0], buf, len) < 0) { + ast_log(LOG_WARNING, "read() failed: %s\n", strerror(errno)); + } close(fds[0]); } else { /* child */ @@ -5533,7 +5535,9 @@ static void adsi_message(struct ast_channel *chan, struct vm_state *vms) 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; |