aboutsummaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2008-11-02 23:56:13 +0000
committerkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2008-11-02 23:56:13 +0000
commitee246d0e0519c6aa7cb0aea17ea92c9a5c2dc16f (patch)
tree80dccc06626175232f48f4c2cde5b9f5ba602632 /apps
parent11aedae560fa003f20ee8d7a02b7aa2fc17ae13a (diff)
import gcc 4.3.2 warning fixes from trunk, with a few changes specific to this branch
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.1@153710 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps')
-rw-r--r--apps/app_adsiprog.c4
-rw-r--r--apps/app_authenticate.c4
-rw-r--r--apps/app_chanspy.c8
-rw-r--r--apps/app_dial.c10
-rw-r--r--apps/app_festival.c27
-rw-r--r--apps/app_queue.c10
-rw-r--r--apps/app_sms.c4
-rw-r--r--apps/app_stack.c10
-rw-r--r--apps/app_voicemail.c8
9 files changed, 66 insertions, 19 deletions
diff --git a/apps/app_adsiprog.c b/apps/app_adsiprog.c
index 8ee3a0410..159031f9c 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 dea2017ea..86deb0534 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"
@@ -264,8 +265,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 6b3fafd92..1b9647142 100644
--- a/apps/app_dial.c
+++ b/apps/app_dial.c
@@ -1822,10 +1822,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 d9659ebef..649707be9 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"
@@ -138,7 +139,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);
}
@@ -411,17 +416,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;
@@ -451,7 +464,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 8fee61247..0cf9a31c3 100644
--- a/apps/app_queue.c
+++ b/apps/app_queue.c
@@ -3834,10 +3834,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 e0bd0afbb..1398555cc 100644
--- a/apps/app_stack.c
+++ b/apps/app_stack.c
@@ -433,9 +433,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 296c1a2b0..7d632c82f 100644
--- a/apps/app_voicemail.c
+++ b/apps/app_voicemail.c
@@ -865,7 +865,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 */
@@ -5539,7 +5541,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;