[asterisk-commits] kpfleming: branch 1.6.1 r153710 - in /branches/1.6.1: ./ agi/ apps/ channels/...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sun Nov 2 17:56:14 CST 2008


Author: kpfleming
Date: Sun Nov  2 17:56:13 2008
New Revision: 153710

URL: http://svn.digium.com/view/asterisk?view=rev&rev=153710
Log:
import gcc 4.3.2 warning fixes from trunk, with a few changes specific to this branch


Modified:
    branches/1.6.1/   (props changed)
    branches/1.6.1/agi/eagi-sphinx-test.c
    branches/1.6.1/agi/eagi-test.c
    branches/1.6.1/apps/app_adsiprog.c
    branches/1.6.1/apps/app_authenticate.c
    branches/1.6.1/apps/app_chanspy.c
    branches/1.6.1/apps/app_dial.c
    branches/1.6.1/apps/app_festival.c
    branches/1.6.1/apps/app_queue.c
    branches/1.6.1/apps/app_sms.c
    branches/1.6.1/apps/app_stack.c
    branches/1.6.1/apps/app_voicemail.c
    branches/1.6.1/channels/chan_dahdi.c
    branches/1.6.1/channels/chan_h323.c
    branches/1.6.1/channels/chan_iax2.c
    branches/1.6.1/channels/chan_oss.c
    branches/1.6.1/channels/chan_sip.c
    branches/1.6.1/formats/format_gsm.c
    branches/1.6.1/formats/format_ogg_vorbis.c
    branches/1.6.1/formats/format_wav.c
    branches/1.6.1/formats/format_wav_gsm.c
    branches/1.6.1/funcs/func_odbc.c
    branches/1.6.1/main/ast_expr2f.c
    branches/1.6.1/main/asterisk.c
    branches/1.6.1/main/channel.c
    branches/1.6.1/main/db1-ast/hash/hash_page.c
    branches/1.6.1/main/file.c
    branches/1.6.1/main/http.c
    branches/1.6.1/main/logger.c
    branches/1.6.1/main/manager.c
    branches/1.6.1/main/utils.c
    branches/1.6.1/pbx/pbx_config.c
    branches/1.6.1/pbx/pbx_dundi.c
    branches/1.6.1/pbx/pbx_lua.c
    branches/1.6.1/res/ael/ael.flex
    branches/1.6.1/res/ael/ael.tab.c
    branches/1.6.1/res/ael/ael.y
    branches/1.6.1/res/ael/ael_lex.c
    branches/1.6.1/res/res_agi.c
    branches/1.6.1/res/res_config_sqlite.c
    branches/1.6.1/res/res_crypto.c
    branches/1.6.1/res/res_http_post.c
    branches/1.6.1/res/res_jabber.c
    branches/1.6.1/res/res_musiconhold.c
    branches/1.6.1/res/res_phoneprov.c
    branches/1.6.1/utils/astcanary.c
    branches/1.6.1/utils/astman.c
    branches/1.6.1/utils/frame.c
    branches/1.6.1/utils/muted.c
    branches/1.6.1/utils/stereorize.c
    branches/1.6.1/utils/streamplayer.c

Propchange: branches/1.6.1/
------------------------------------------------------------------------------
Binary property 'trunk-blocked' - no diff available.

Propchange: branches/1.6.1/
------------------------------------------------------------------------------
Binary property 'trunk-merged' - no diff available.

Modified: branches/1.6.1/agi/eagi-sphinx-test.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.1/agi/eagi-sphinx-test.c?view=diff&rev=153710&r1=153709&r2=153710
==============================================================================
--- branches/1.6.1/agi/eagi-sphinx-test.c (original)
+++ branches/1.6.1/agi/eagi-sphinx-test.c Sun Nov  2 17:56:13 2008
@@ -79,7 +79,9 @@
 	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 @@
 			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 @@
 		}
 		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)) {

Modified: branches/1.6.1/agi/eagi-test.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.1/agi/eagi-test.c?view=diff&rev=153710&r1=153709&r2=153710
==============================================================================
--- branches/1.6.1/agi/eagi-test.c (original)
+++ branches/1.6.1/agi/eagi-test.c Sun Nov  2 17:56:13 2008
@@ -24,7 +24,9 @@
 	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';
@@ -68,7 +70,9 @@
 			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;

Modified: branches/1.6.1/apps/app_adsiprog.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.1/apps/app_adsiprog.c?view=diff&rev=153710&r1=153709&r2=153710
==============================================================================
--- branches/1.6.1/apps/app_adsiprog.c (original)
+++ branches/1.6.1/apps/app_adsiprog.c Sun Nov  2 17:56:13 2008
@@ -1369,7 +1369,9 @@
 	/* 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 */

Modified: branches/1.6.1/apps/app_authenticate.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.1/apps/app_authenticate.c?view=diff&rev=153710&r1=153709&r2=153710
==============================================================================
--- branches/1.6.1/apps/app_authenticate.c (original)
+++ branches/1.6.1/apps/app_authenticate.c Sun Nov  2 17:56:13 2008
@@ -151,7 +151,9 @@
 				if (feof(f))
 					break;
 
-				fgets(buf, sizeof(buf), f);
+				if (!fgets(buf, sizeof(buf), f)) {
+					continue;
+				}
 
 				if (ast_strlen_zero(buf))
 					continue;

Modified: branches/1.6.1/apps/app_chanspy.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.1/apps/app_chanspy.c?view=diff&rev=153710&r1=153709&r2=153710
==============================================================================
--- branches/1.6.1/apps/app_chanspy.c (original)
+++ branches/1.6.1/apps/app_chanspy.c Sun Nov  2 17:56:13 2008
@@ -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 @@
 		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);
 

Modified: branches/1.6.1/apps/app_dial.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.1/apps/app_dial.c?view=diff&rev=153710&r1=153709&r2=153710
==============================================================================
--- branches/1.6.1/apps/app_dial.c (original)
+++ branches/1.6.1/apps/app_dial.c Sun Nov  2 17:56:13 2008
@@ -1822,10 +1822,16 @@
 				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) {

Modified: branches/1.6.1/apps/app_festival.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.1/apps/app_festival.c?view=diff&rev=153710&r1=153709&r2=153710
==============================================================================
--- branches/1.6.1/apps/app_festival.c (original)
+++ branches/1.6.1/apps/app_festival.c Sun Nov  2 17:56:13 2008
@@ -38,6 +38,7 @@
 #include <signal.h>
 #include <fcntl.h>
 #include <ctype.h>
+#include <errno.h>
 
 #include "asterisk/file.h"
 #include "asterisk/channel.h"
@@ -138,7 +139,11 @@
 		*(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 @@
 				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 @@
 	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);

Modified: branches/1.6.1/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.1/apps/app_queue.c?view=diff&rev=153710&r1=153709&r2=153710
==============================================================================
--- branches/1.6.1/apps/app_queue.c (original)
+++ branches/1.6.1/apps/app_queue.c Sun Nov  2 17:56:13 2008
@@ -3834,10 +3834,16 @@
 				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);

Modified: branches/1.6.1/apps/app_sms.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.1/apps/app_sms.c?view=diff&rev=153710&r1=153709&r2=153710
==============================================================================
--- branches/1.6.1/apps/app_sms.c (original)
+++ branches/1.6.1/apps/app_sms.c Sun Nov  2 17:56:13 2008
@@ -779,7 +779,9 @@
 		}
 		*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;

Modified: branches/1.6.1/apps/app_stack.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.1/apps/app_stack.c?view=diff&rev=153710&r1=153709&r2=153710
==============================================================================
--- branches/1.6.1/apps/app_stack.c (original)
+++ branches/1.6.1/apps/app_stack.c Sun Nov  2 17:56:13 2008
@@ -433,9 +433,15 @@
 	 * 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) {

Modified: branches/1.6.1/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.1/apps/app_voicemail.c?view=diff&rev=153710&r1=153709&r2=153710
==============================================================================
--- branches/1.6.1/apps/app_voicemail.c (original)
+++ branches/1.6.1/apps/app_voicemail.c Sun Nov  2 17:56:13 2008
@@ -865,7 +865,9 @@
 		} 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 @@
 	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;

Modified: branches/1.6.1/channels/chan_dahdi.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.1/channels/chan_dahdi.c?view=diff&rev=153710&r1=153709&r2=153710
==============================================================================
--- branches/1.6.1/channels/chan_dahdi.c (original)
+++ branches/1.6.1/channels/chan_dahdi.c Sun Nov  2 17:56:13 2008
@@ -10269,8 +10269,11 @@
 
 	ast_mutex_lock(&pridebugfdlock);
 
-	if (pridebugfd >= 0)
-		write(pridebugfd, s, strlen(s));
+	if (pridebugfd >= 0) {
+		if (write(pridebugfd, s, strlen(s)) < 0) {
+			ast_log(LOG_WARNING, "write() failed: %s\n", strerror(errno));
+		}
+	}
 
 	ast_mutex_unlock(&pridebugfdlock);
 }
@@ -10305,8 +10308,11 @@
 
 	ast_mutex_lock(&pridebugfdlock);
 
-	if (pridebugfd >= 0)
-		write(pridebugfd, s, strlen(s));
+	if (pridebugfd >= 0) {
+		if (write(pridebugfd, s, strlen(s)) < 0) {
+			ast_log(LOG_WARNING, "write() failed: %s\n", strerror(errno));
+		}
+	}
 
 	ast_mutex_unlock(&pridebugfdlock);
 }
@@ -11601,7 +11607,9 @@
 
 	for (which = span = 0; span < NUM_SPANS; span++) {
 		if (pris[span].pri && ++which > state) {
-			asprintf(&ret, "%d", span + 1);	/* user indexes start from 1 */
+			if (asprintf(&ret, "%d", span + 1) < 0) {	/* user indexes start from 1 */
+				ast_log(LOG_WARNING, "asprintf() failed: %s\n", strerror(errno));
+			}
 			break;
 		}
 	}

Modified: branches/1.6.1/channels/chan_h323.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.1/channels/chan_h323.c?view=diff&rev=153710&r1=153709&r2=153710
==============================================================================
--- branches/1.6.1/channels/chan_h323.c (original)
+++ branches/1.6.1/channels/chan_h323.c Sun Nov  2 17:56:13 2008
@@ -1246,7 +1246,7 @@
 
 static int update_common_options(struct ast_variable *v, struct call_options *options)
 {
-	int tmp;
+	int tmp = 0;
 	char *val, *opt;
 
 	if (!strcasecmp(v->name, "allow")) {

Modified: branches/1.6.1/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.1/channels/chan_iax2.c?view=diff&rev=153710&r1=153709&r2=153710
==============================================================================
--- branches/1.6.1/channels/chan_iax2.c (original)
+++ branches/1.6.1/channels/chan_iax2.c Sun Nov  2 17:56:13 2008
@@ -6641,8 +6641,10 @@
 		}
 		/* Wake up waiters */
 		for (x = 0; x < ARRAY_LEN(dp->waiters); x++) {
-			if (dp->waiters[x] > -1)
-				write(dp->waiters[x], "asdf", 4);
+			if (dp->waiters[x] > -1) {
+				if (write(dp->waiters[x], "asdf", 4) < 0) {
+				}
+			}
 		}
 	}
 	AST_LIST_TRAVERSE_SAFE_END;
@@ -11700,8 +11702,11 @@
 				   systems without leaving it unavailable once the server comes back online */
 				dp->expiry.tv_sec = dp->orig.tv_sec + 60;
 				for (x = 0; x < ARRAY_LEN(dp->waiters); x++) {
-					if (dp->waiters[x] > -1)
-						write(dp->waiters[x], "asdf", 4);
+					if (dp->waiters[x] > -1) {
+						if (write(dp->waiters[x], "asdf", 4) < 0) {
+							ast_log(LOG_WARNING, "write() failed: %s\n", strerror(errno));
+						}
+					}
 				}
 			}
 		}

Modified: branches/1.6.1/channels/chan_oss.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.1/channels/chan_oss.c?view=diff&rev=153710&r1=153709&r2=153710
==============================================================================
--- branches/1.6.1/channels/chan_oss.c (original)
+++ branches/1.6.1/channels/chan_oss.c Sun Nov  2 17:56:13 2008
@@ -1382,10 +1382,15 @@
 	if (o->mixer_cmd) {
 		char *cmd;
 
-		asprintf(&cmd, "mixer %s", o->mixer_cmd);
-		ast_log(LOG_WARNING, "running [%s]\n", cmd);
-		system(cmd);
-		ast_free(cmd);
+		if (asprintf(&cmd, "mixer %s", o->mixer_cmd) < 0) {
+			ast_log(LOG_WARNING, "asprintf() failed: %s\n", strerror(errno));
+		} else {
+			ast_log(LOG_WARNING, "running [%s]\n", cmd);
+			if (system(cmd) < 0) {
+				ast_log(LOG_WARNING, "system() failed: %s\n", strerror(errno));
+			}
+			ast_free(cmd);
+		}
 	}
 
 	/* if the config file requested to start the GUI, do it */

Modified: branches/1.6.1/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.1/channels/chan_sip.c?view=diff&rev=153710&r1=153709&r2=153710
==============================================================================
--- branches/1.6.1/channels/chan_sip.c (original)
+++ branches/1.6.1/channels/chan_sip.c Sun Nov  2 17:56:13 2008
@@ -21366,8 +21366,9 @@
 	if (!ast_strlen_zero(callback)) { /* build string from peer info */
 		char *reg_string;
 
-		asprintf(&reg_string, "%s:%s@%s/%s", peer->username, peer->secret, peer->tohost, callback);
-		if (reg_string) {
+		if (asprintf(&reg_string, "%s:%s@%s/%s", peer->username, peer->secret, peer->tohost, callback) < 0) {
+			ast_log(LOG_WARNING, "asprintf() failed: %s\n", strerror(errno));
+		} else	if (reg_string) {
 			sip_register(reg_string, 0); /* XXX TODO: count in registry_count */
 			ast_free(reg_string);
 		}

Modified: branches/1.6.1/formats/format_gsm.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.1/formats/format_gsm.c?view=diff&rev=153710&r1=153709&r2=153710
==============================================================================
--- branches/1.6.1/formats/format_gsm.c (original)
+++ branches/1.6.1/formats/format_gsm.c Sun Nov  2 17:56:13 2008
@@ -126,7 +126,9 @@
 		int i;
 		fseeko(fs->f, 0, SEEK_END);
 		for (i=0; i< (offset - max) / GSM_FRAME_SIZE; i++) {
-			fwrite(gsm_silence, 1, GSM_FRAME_SIZE, fs->f);
+			if (!fwrite(gsm_silence, 1, GSM_FRAME_SIZE, fs->f)) {
+				ast_log(LOG_WARNING, "fwrite() failed: %s\n", strerror(errno));
+			}
 		}
 	}
 	return fseeko(fs->f, offset, SEEK_SET);

Modified: branches/1.6.1/formats/format_ogg_vorbis.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.1/formats/format_ogg_vorbis.c?view=diff&rev=153710&r1=153709&r2=153710
==============================================================================
--- branches/1.6.1/formats/format_ogg_vorbis.c (original)
+++ branches/1.6.1/formats/format_ogg_vorbis.c Sun Nov  2 17:56:13 2008
@@ -225,8 +225,12 @@
 	while (!tmp->eos) {
 		if (ogg_stream_flush(&tmp->os, &tmp->og) == 0)
 			break;
-		fwrite(tmp->og.header, 1, tmp->og.header_len, s->f);
-		fwrite(tmp->og.body, 1, tmp->og.body_len, s->f);
+		if (!fwrite(tmp->og.header, 1, tmp->og.header_len, s->f)) {
+			ast_log(LOG_WARNING, "fwrite() failed: %s\n", strerror(errno));
+		}
+		if (!fwrite(tmp->og.body, 1, tmp->og.body_len, s->f)) {
+			ast_log(LOG_WARNING, "fwrite() failed: %s\n", strerror(errno));
+		}
 		if (ogg_page_eos(&tmp->og))
 			tmp->eos = 1;
 	}
@@ -251,8 +255,12 @@
 				if (ogg_stream_pageout(&s->os, &s->og) == 0) {
 					break;
 				}
-				fwrite(s->og.header, 1, s->og.header_len, f);
-				fwrite(s->og.body, 1, s->og.body_len, f);
+				if (!fwrite(s->og.header, 1, s->og.header_len, f)) {
+				ast_log(LOG_WARNING, "fwrite() failed: %s\n", strerror(errno));
+				}
+				if (!fwrite(s->og.body, 1, s->og.body_len, f)) {
+					ast_log(LOG_WARNING, "fwrite() failed: %s\n", strerror(errno));
+				}
 				if (ogg_page_eos(&s->og)) {
 					s->eos = 1;
 				}

Modified: branches/1.6.1/formats/format_wav.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.1/formats/format_wav.c?view=diff&rev=153710&r1=153709&r2=153710
==============================================================================
--- branches/1.6.1/formats/format_wav.c (original)
+++ branches/1.6.1/formats/format_wav.c Sun Nov  2 17:56:13 2008
@@ -334,8 +334,11 @@
 	}
 
 	/* Pad to even length */
-	if (fs->bytes & 0x1)
-		fwrite(&zero, 1, 1, s->f);
+	if (fs->bytes & 0x1) {
+		if (!fwrite(&zero, 1, 1, s->f)) {
+			ast_log(LOG_WARNING, "fwrite() failed: %s\n", strerror(errno));
+		}
+	}
 }
 
 static struct ast_frame *wav_read(struct ast_filestream *s, int *whennext)

Modified: branches/1.6.1/formats/format_wav_gsm.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.1/formats/format_wav_gsm.c?view=diff&rev=153710&r1=153709&r2=153710
==============================================================================
--- branches/1.6.1/formats/format_wav_gsm.c (original)
+++ branches/1.6.1/formats/format_wav_gsm.c Sun Nov  2 17:56:13 2008
@@ -496,7 +496,9 @@
 		int i;
 		fseek(fs->f, 0, SEEK_END);
 		for (i=0; i< (offset - max) / MSGSM_FRAME_SIZE; i++) {
-			fwrite(msgsm_silence, 1, MSGSM_FRAME_SIZE, fs->f);
+			if (!fwrite(msgsm_silence, 1, MSGSM_FRAME_SIZE, fs->f)) {
+				ast_log(LOG_WARNING, "fwrite() failed: %s\n", strerror(errno));
+			}
 		}
 	}
 	s->secondhalf = 0;

Modified: branches/1.6.1/funcs/func_odbc.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.1/funcs/func_odbc.c?view=diff&rev=153710&r1=153709&r2=153710
==============================================================================
--- branches/1.6.1/funcs/func_odbc.c (original)
+++ branches/1.6.1/funcs/func_odbc.c Sun Nov  2 17:56:13 2008
@@ -628,6 +628,7 @@
 {
 	const char *tmp;
 	int i;
+	int res;
 
 	if (!cfg || !catg) {
 		return EINVAL;
@@ -717,9 +718,13 @@
 	}
 
 	if ((tmp = ast_variable_retrieve(cfg, catg, "prefix")) && !ast_strlen_zero(tmp)) {
-		asprintf((char **)&((*query)->acf->name), "%s_%s", tmp, catg);
+		if (asprintf((char **)&((*query)->acf->name), "%s_%s", tmp, catg) < 0) {
+			ast_log(LOG_WARNING, "asprintf() failed: %s\n", strerror(errno));
+		}
 	} else {
-		asprintf((char **)&((*query)->acf->name), "ODBC_%s", catg);
+		if (asprintf((char **)&((*query)->acf->name), "ODBC_%s", catg) < 0) {
+			ast_log(LOG_WARNING, "asprintf() failed: %s\n", strerror(errno));
+		}
 	}
 
 	if (!((*query)->acf->name)) {
@@ -729,7 +734,10 @@
 		return ENOMEM;
 	}
 
-	asprintf((char **)&((*query)->acf->syntax), "%s(<arg1>[...[,<argN>]])", (*query)->acf->name);
+	if (asprintf((char **)&((*query)->acf->syntax), "%s(<arg1>[...[,<argN>]])", (*query)->acf->name) < 0) {
+		ast_log(LOG_WARNING, "asprintf() failed: %s\n", strerror(errno));
+		(*query)->acf->syntax = NULL;
+	}
 
 	if (!((*query)->acf->syntax)) {
 		ast_free((char *)(*query)->acf->name);
@@ -740,29 +748,31 @@
 	}
 
 	(*query)->acf->synopsis = "Runs the referenced query with the specified arguments";
+
+	res = 0;
 	if (!ast_strlen_zero((*query)->sql_read) && !ast_strlen_zero((*query)->sql_write)) {
-		asprintf((char **)&((*query)->acf->desc),
-					"Runs the following query, as defined in func_odbc.conf, performing\n"
-				   	"substitution of the arguments into the query as specified by ${ARG1},\n"
-					"${ARG2}, ... ${ARGn}.  When setting the function, the values are provided\n"
-					"either in whole as ${VALUE} or parsed as ${VAL1}, ${VAL2}, ... ${VALn}.\n"
-					"\nRead:\n%s\n\nWrite:\n%s\n",
-					(*query)->sql_read,
-					(*query)->sql_write);
+		res = asprintf((char **)&((*query)->acf->desc),
+			       "Runs the following query, as defined in func_odbc.conf, performing\n"
+			       "substitution of the arguments into the query as specified by ${ARG1},\n"
+			       "${ARG2}, ... ${ARGn}.  When setting the function, the values are provided\n"
+			       "either in whole as ${VALUE} or parsed as ${VAL1}, ${VAL2}, ... ${VALn}.\n"
+			       "\nRead:\n%s\n\nWrite:\n%s\n",
+			       (*query)->sql_read,
+			       (*query)->sql_write);
 	} else if (!ast_strlen_zero((*query)->sql_read)) {
-		asprintf((char **)&((*query)->acf->desc),
-					"Runs the following query, as defined in func_odbc.conf, performing\n"
-				   	"substitution of the arguments into the query as specified by ${ARG1},\n"
-					"${ARG2}, ... ${ARGn}.  This function may only be read, not set.\n\nSQL:\n%s\n",
-					(*query)->sql_read);
+		res = asprintf((char **)&((*query)->acf->desc),
+			       "Runs the following query, as defined in func_odbc.conf, performing\n"
+			       "substitution of the arguments into the query as specified by ${ARG1},\n"
+			       "${ARG2}, ... ${ARGn}.  This function may only be read, not set.\n\nSQL:\n%s\n",
+			       (*query)->sql_read);
 	} else if (!ast_strlen_zero((*query)->sql_write)) {
-		asprintf((char **)&((*query)->acf->desc),
-					"Runs the following query, as defined in func_odbc.conf, performing\n"
-				   	"substitution of the arguments into the query as specified by ${ARG1},\n"
-					"${ARG2}, ... ${ARGn}.  The values are provided either in whole as\n"
-					"${VALUE} or parsed as ${VAL1}, ${VAL2}, ... ${VALn}.\n"
-					"This function may only be set.\nSQL:\n%s\n",
-					(*query)->sql_write);
+		res = asprintf((char **)&((*query)->acf->desc),
+			       "Runs the following query, as defined in func_odbc.conf, performing\n"
+			       "substitution of the arguments into the query as specified by ${ARG1},\n"
+			       "${ARG2}, ... ${ARGn}.  The values are provided either in whole as\n"
+			       "${VALUE} or parsed as ${VAL1}, ${VAL2}, ... ${VALn}.\n"
+			       "This function may only be set.\nSQL:\n%s\n",
+			       (*query)->sql_write);
 	} else {
 		ast_free((char *)(*query)->acf->syntax);
 		ast_free((char *)(*query)->acf->name);
@@ -772,7 +782,13 @@
 		return EINVAL;
 	}
 
-	if (! ((*query)->acf->desc)) {
+	if (res < 0) {
+		ast_log(LOG_WARNING, "asprintf() failed: %s\n", strerror(errno));
+		(*query)->acf->desc = NULL;
+	}
+
+
+	if (!((*query)->acf->desc)) {
 		ast_free((char *)(*query)->acf->syntax);
 		ast_free((char *)(*query)->acf->name);
 		ast_free((*query)->acf);

Modified: branches/1.6.1/main/ast_expr2f.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.1/main/ast_expr2f.c?view=diff&rev=153710&r1=153709&r2=153710
==============================================================================
--- branches/1.6.1/main/ast_expr2f.c (original)
+++ branches/1.6.1/main/ast_expr2f.c Sun Nov  2 17:56:13 2008
@@ -11,7 +11,7 @@
 #define FLEX_SCANNER
 #define YY_FLEX_MAJOR_VERSION 2
 #define YY_FLEX_MINOR_VERSION 5
-#define YY_FLEX_SUBMINOR_VERSION 33
+#define YY_FLEX_SUBMINOR_VERSION 35
 #if YY_FLEX_SUBMINOR_VERSION > 0
 #define FLEX_BETA
 #endif
@@ -33,7 +33,7 @@
 
 /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
 
-#if !defined __STDC_VERSION__ || __STDC_VERSION__ >= 199901L
+#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
 
 /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
  * if you want the limit (max/min) macros for int types. 
@@ -56,7 +56,6 @@
 typedef unsigned char flex_uint8_t; 
 typedef unsigned short int flex_uint16_t;
 typedef unsigned int flex_uint32_t;
-#endif /* ! C99 */
 
 /* Limits of integral types. */
 #ifndef INT8_MIN
@@ -87,6 +86,8 @@
 #define UINT32_MAX             (4294967295U)
 #endif
 
+#endif /* ! C99 */
+
 #endif /* ! FLEXINT_H */
 
 #ifdef __cplusplus
@@ -96,11 +97,12 @@
 
 #else	/* ! __cplusplus */
 
-#if __STDC__
+/* C99 requires __STDC__ to be defined as 1. */
+#if defined (__STDC__)
 
 #define YY_USE_CONST
 
-#endif	/* __STDC__ */
+#endif	/* defined (__STDC__) */
 #endif	/* ! __cplusplus */
 
 #ifdef YY_USE_CONST
@@ -135,8 +137,6 @@
 #define yylineno (YY_CURRENT_BUFFER_LVALUE->yy_bs_lineno)
 #define yycolumn (YY_CURRENT_BUFFER_LVALUE->yy_bs_column)
 #define yy_flex_debug yyg->yy_flex_debug_r
-
-int ast_yylex_init (yyscan_t* scanner);
 
 /* Enter a start condition.  This macro really ought to take a parameter,
  * but we do it the disgusting crufty way forced on us by the ()-less
@@ -195,14 +195,9 @@
 
 #define unput(c) yyunput( c, yyg->yytext_ptr , yyscanner )
 
-/* The following is because we cannot portably get our hands on size_t
- * (without autoconf's help, which isn't available because we want
- * flex-generated scanners to compile on their own).
- */
-
 #ifndef YY_TYPEDEF_YY_SIZE_T
 #define YY_TYPEDEF_YY_SIZE_T
-typedef unsigned int yy_size_t;
+typedef size_t yy_size_t;
 #endif
 
 #ifndef YY_STRUCT_YY_BUFFER_STATE
@@ -2406,7 +2401,7 @@
 static int curlycount = 0;
 static char *expr2_token_subst(const char *mess);
 
-#line 2410 "ast_expr2f.c"
+#line 2403 "ast_expr2f.c"
 
 #define INITIAL 0
 #define var 1
@@ -2470,6 +2465,10 @@
     
     #    define yylloc yyg->yylloc_r
     
+int ast_yylex_init (yyscan_t* scanner);
+
+int ast_yylex_init_extra (YY_EXTRA_TYPE user_defined,yyscan_t* scanner);
+
 /* Accessor methods to globals.
    These are made visible to non-reentrant scanners for convenience. */
 
@@ -2549,7 +2548,7 @@
 /* This used to be an fputs(), but since the string might contain NUL's,
  * we now use fwrite().
  */
-#define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
+#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0)
 #endif
 
 /* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
@@ -2629,10 +2628,10 @@
 	register int yy_act;
     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
 
-#line 127 "ast_expr2.fl"
-
-
-#line 2636 "ast_expr2f.c"
+#line 125 "ast_expr2.fl"
+
+
+#line 2633 "ast_expr2f.c"
 
     yylval = yylval_param;
 
@@ -2715,132 +2714,132 @@
 
 case 1:
 YY_RULE_SETUP
-#line 129 "ast_expr2.fl"
+#line 127 "ast_expr2.fl"
 { SET_COLUMNS; SET_STRING; return TOK_OR;}
 	YY_BREAK
 case 2:
 YY_RULE_SETUP
-#line 130 "ast_expr2.fl"
+#line 128 "ast_expr2.fl"
 { SET_COLUMNS; SET_STRING; return TOK_AND;}
 	YY_BREAK
 case 3:
 YY_RULE_SETUP
-#line 131 "ast_expr2.fl"
+#line 129 "ast_expr2.fl"
 { SET_COLUMNS; SET_STRING; return TOK_EQ;}
 	YY_BREAK
 case 4:
 YY_RULE_SETUP
-#line 132 "ast_expr2.fl"
+#line 130 "ast_expr2.fl"
 { SET_COLUMNS; SET_STRING; return TOK_OR;}
 	YY_BREAK
 case 5:
 YY_RULE_SETUP
-#line 133 "ast_expr2.fl"
+#line 131 "ast_expr2.fl"
 { SET_COLUMNS; SET_STRING; return TOK_AND;}
 	YY_BREAK
 case 6:
 YY_RULE_SETUP
-#line 134 "ast_expr2.fl"
+#line 132 "ast_expr2.fl"
 { SET_COLUMNS; SET_STRING; return TOK_EQ;}
 	YY_BREAK
 case 7:
 YY_RULE_SETUP
-#line 135 "ast_expr2.fl"
+#line 133 "ast_expr2.fl"
 { SET_COLUMNS; SET_STRING; return TOK_EQTILDE;}
 	YY_BREAK
 case 8:
 YY_RULE_SETUP
-#line 136 "ast_expr2.fl"
+#line 134 "ast_expr2.fl"
 { SET_COLUMNS; SET_STRING; return TOK_TILDETILDE;}
 	YY_BREAK
 case 9:
 YY_RULE_SETUP
-#line 137 "ast_expr2.fl"
+#line 135 "ast_expr2.fl"
 { SET_COLUMNS; SET_STRING; return TOK_GT;}
 	YY_BREAK
 case 10:
 YY_RULE_SETUP
-#line 138 "ast_expr2.fl"
+#line 136 "ast_expr2.fl"
 { SET_COLUMNS; SET_STRING; return TOK_LT;}
 	YY_BREAK
 case 11:
 YY_RULE_SETUP
-#line 139 "ast_expr2.fl"
+#line 137 "ast_expr2.fl"
 { SET_COLUMNS; SET_STRING; return TOK_GE;}
 	YY_BREAK
 case 12:
 YY_RULE_SETUP
-#line 140 "ast_expr2.fl"
+#line 138 "ast_expr2.fl"
 { SET_COLUMNS; SET_STRING; return TOK_LE;}
 	YY_BREAK
 case 13:
 YY_RULE_SETUP
-#line 141 "ast_expr2.fl"
+#line 139 "ast_expr2.fl"
 { SET_COLUMNS; SET_STRING; return TOK_NE;}
 	YY_BREAK
 case 14:
 YY_RULE_SETUP
-#line 142 "ast_expr2.fl"
+#line 140 "ast_expr2.fl"
 { SET_COLUMNS; SET_STRING; return TOK_PLUS;}
 	YY_BREAK
 case 15:
 YY_RULE_SETUP
-#line 143 "ast_expr2.fl"
+#line 141 "ast_expr2.fl"
 { SET_COLUMNS; SET_STRING; return TOK_COMMA;}
 	YY_BREAK
 case 16:
 YY_RULE_SETUP
-#line 144 "ast_expr2.fl"
+#line 142 "ast_expr2.fl"
 { SET_COLUMNS; SET_STRING; return TOK_MINUS;}
 	YY_BREAK
 case 17:
 YY_RULE_SETUP
-#line 145 "ast_expr2.fl"
+#line 143 "ast_expr2.fl"
 { SET_COLUMNS; SET_STRING; return TOK_MULT;}
 	YY_BREAK
 case 18:
 YY_RULE_SETUP
-#line 146 "ast_expr2.fl"
+#line 144 "ast_expr2.fl"
 { SET_COLUMNS; SET_STRING; return TOK_DIV;}
 	YY_BREAK
 case 19:
 YY_RULE_SETUP
-#line 147 "ast_expr2.fl"
+#line 145 "ast_expr2.fl"
 { SET_COLUMNS; SET_STRING; return TOK_MOD;}
 	YY_BREAK
 case 20:
 YY_RULE_SETUP
-#line 148 "ast_expr2.fl"
+#line 146 "ast_expr2.fl"
 { SET_COLUMNS; SET_STRING; return TOK_COND;}
 	YY_BREAK
 case 21:
 YY_RULE_SETUP
-#line 149 "ast_expr2.fl"
+#line 147 "ast_expr2.fl"
 { SET_COLUMNS; SET_STRING; return TOK_COMPL;}
 	YY_BREAK
 case 22:
 YY_RULE_SETUP
-#line 150 "ast_expr2.fl"
+#line 148 "ast_expr2.fl"
 { SET_COLUMNS; SET_STRING; return TOK_COLON;}
 	YY_BREAK
 case 23:
 YY_RULE_SETUP
-#line 151 "ast_expr2.fl"
+#line 149 "ast_expr2.fl"
 { SET_COLUMNS; SET_STRING; return TOK_COLONCOLON;}
 	YY_BREAK
 case 24:
 YY_RULE_SETUP
-#line 152 "ast_expr2.fl"
+#line 150 "ast_expr2.fl"
 { SET_COLUMNS; SET_STRING; return TOK_LP;}
 	YY_BREAK
 case 25:
 YY_RULE_SETUP
-#line 153 "ast_expr2.fl"
+#line 151 "ast_expr2.fl"
 { SET_COLUMNS; SET_STRING; return TOK_RP;}
 	YY_BREAK
 case 26:
 YY_RULE_SETUP
-#line 154 "ast_expr2.fl"
+#line 152 "ast_expr2.fl"
 {
 		/* gather the contents of ${} expressions, with trailing stuff,
 		 * into a single TOKEN.
@@ -2853,24 +2852,24 @@
 	YY_BREAK
 case 27:
 YY_RULE_SETUP
-#line 164 "ast_expr2.fl"
+#line 162 "ast_expr2.fl"
 {}
 	YY_BREAK
 case 28:
 /* rule 28 can match eol */
 YY_RULE_SETUP
-#line 165 "ast_expr2.fl"
+#line 163 "ast_expr2.fl"
 {SET_COLUMNS; SET_STRING; return TOKEN;}
 	YY_BREAK
 case 29:
 /* rule 29 can match eol */
 YY_RULE_SETUP
-#line 167 "ast_expr2.fl"
+#line 165 "ast_expr2.fl"
 {/* what to do with eol */}
 	YY_BREAK
 case 30:
 YY_RULE_SETUP
-#line 168 "ast_expr2.fl"
+#line 166 "ast_expr2.fl"
 {
 		SET_COLUMNS;
 		/* the original behavior of the expression parser was
@@ -2883,7 +2882,7 @@
 case 31:
 /* rule 31 can match eol */
 YY_RULE_SETUP
-#line 177 "ast_expr2.fl"
+#line 175 "ast_expr2.fl"
 {
 		SET_COLUMNS;
 		SET_STRING;
@@ -2893,7 +2892,7 @@
 case 32:
 /* rule 32 can match eol */
 YY_RULE_SETUP
-#line 184 "ast_expr2.fl"
+#line 182 "ast_expr2.fl"
 {
 		curlycount--;
 		if (curlycount < 0) {
@@ -2907,7 +2906,7 @@
 case 33:
 /* rule 33 can match eol */
 YY_RULE_SETUP
-#line 194 "ast_expr2.fl"
+#line 192 "ast_expr2.fl"
 {
 		curlycount++;
 		yymore();
@@ -2915,7 +2914,7 @@
 	YY_BREAK
 case 34:
 YY_RULE_SETUP
-#line 200 "ast_expr2.fl"
+#line 198 "ast_expr2.fl"
 {
 		BEGIN(0);
 		SET_COLUMNS;
@@ -2926,7 +2925,7 @@
 case 35:
 /* rule 35 can match eol */
 YY_RULE_SETUP
-#line 207 "ast_expr2.fl"
+#line 205 "ast_expr2.fl"
 {
 		char c = yytext[yyleng-1];
 		BEGIN(0);
@@ -2938,7 +2937,7 @@
 	YY_BREAK
 case 36:
 YY_RULE_SETUP
-#line 216 "ast_expr2.fl"
+#line 214 "ast_expr2.fl"
 {
 		curlycount = 0;
 		BEGIN(var);
@@ -2946,7 +2945,7 @@
 	}
 	YY_BREAK
 case YY_STATE_EOF(trail):
-#line 222 "ast_expr2.fl"
+#line 220 "ast_expr2.fl"
 {
 		BEGIN(0);
 		SET_COLUMNS;
@@ -2957,10 +2956,10 @@
 	YY_BREAK
 case 37:
 YY_RULE_SETUP
-#line 230 "ast_expr2.fl"
+#line 228 "ast_expr2.fl"
 ECHO;
 	YY_BREAK
-#line 2964 "ast_expr2f.c"
+#line 2961 "ast_expr2f.c"
 case YY_STATE_EOF(INITIAL):
 case YY_STATE_EOF(var):
 	yyterminate();
@@ -3217,6 +3216,14 @@
 	else
 		ret_val = EOB_ACT_CONTINUE_SCAN;
 
+	if ((yy_size_t) (yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
+		/* Extend the array by 50%, plus the number we really need. */
+		yy_size_t new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1);
+		YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) ast_yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ,yyscanner );
+		if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
+			YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
+	}
+
 	yyg->yy_n_chars += number_to_move;
 	YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] = YY_END_OF_BUFFER_CHAR;
 	YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
@@ -3640,7 +3647,9 @@
 		yyg->yy_buffer_stack = (struct yy_buffer_state**)ast_yyalloc
 								(num_to_alloc * sizeof(struct yy_buffer_state*)
 								, yyscanner);
-		
+		if ( ! yyg->yy_buffer_stack )
+			YY_FATAL_ERROR( "out of dynamic memory in ast_yyensure_buffer_stack()" );
+								  
 		memset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state*));
 				
 		yyg->yy_buffer_stack_max = num_to_alloc;
@@ -3658,6 +3667,8 @@
 								(yyg->yy_buffer_stack,
 								num_to_alloc * sizeof(struct yy_buffer_state*)
 								, yyscanner);
+		if ( ! yyg->yy_buffer_stack )
+			YY_FATAL_ERROR( "out of dynamic memory in ast_yyensure_buffer_stack()" );
 
 		/* zero only the new slots.*/
 		memset(yyg->yy_buffer_stack + yyg->yy_buffer_stack_max, 0, grow_size * sizeof(struct yy_buffer_state*));
@@ -3976,6 +3987,42 @@
     return yy_init_globals ( *ptr_yy_globals );
 }
 
+/* ast_yylex_init_extra has the same functionality as ast_yylex_init, but follows the
+ * convention of taking the scanner as the last argument. Note however, that
+ * this is a *pointer* to a scanner, as it will be allocated by this call (and
+ * is the reason, too, why this function also must handle its own declaration).
+ * The user defined value in the first argument will be available to ast_yyalloc in
+ * the yyextra field.
+ */
+
+int ast_yylex_init_extra(YY_EXTRA_TYPE yy_user_defined,yyscan_t* ptr_yy_globals )
+
+{
+    struct yyguts_t dummy_yyguts;
+
+    ast_yyset_extra (yy_user_defined, &dummy_yyguts);
+
+    if (ptr_yy_globals == NULL){
+        errno = EINVAL;
+        return 1;
+    }
+	
+    *ptr_yy_globals = (yyscan_t) ast_yyalloc ( sizeof( struct yyguts_t ), &dummy_yyguts );
+	
+    if (*ptr_yy_globals == NULL){
+        errno = ENOMEM;
+        return 1;
+    }
+    
+    /* By setting to 0xAA, we expose bugs in
+    yy_init_globals. Leave at 0x00 for releases. */
+    memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
+    
+    ast_yyset_extra (yy_user_defined, *ptr_yy_globals);
+    
+    return yy_init_globals ( *ptr_yy_globals );
+}
+
 static int yy_init_globals (yyscan_t yyscanner)
 {
     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
@@ -4082,7 +4129,7 @@
 
 #define YYTABLES_NAME "yytables"
 
-#line 230 "ast_expr2.fl"
+#line 228 "ast_expr2.fl"
 
 
 

Modified: branches/1.6.1/main/asterisk.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.1/main/asterisk.c?view=diff&rev=153710&r1=153709&r2=153710
==============================================================================
--- branches/1.6.1/main/asterisk.c (original)
+++ branches/1.6.1/main/asterisk.c Sun Nov  2 17:56:13 2008
@@ -1223,8 +1223,11 @@
 	if (restartnow)
 		execvp(_argv[0], _argv);
 	sig_flags.need_reload = 1;
-	if (sig_alert_pipe[1] != -1)
-		write(sig_alert_pipe[1], &a, sizeof(a));
+	if (sig_alert_pipe[1] != -1) {
+		if (write(sig_alert_pipe[1], &a, sizeof(a)) < 0) {
+			fprintf(stderr, "hup_handler: write() failed: %s\n", strerror(errno));
+		}
+	}
 	signal(num, hup_handler);
 }
 
@@ -1439,8 +1442,11 @@
 {
 	int a = 0;
 	sig_flags.need_quit = 1;
-	if (sig_alert_pipe[1] != -1)
-		write(sig_alert_pipe[1], &a, sizeof(a));
+	if (sig_alert_pipe[1] != -1) {
+		if (write(sig_alert_pipe[1], &a, sizeof(a)) < 0) {
+			fprintf(stderr, "hup_handler: write() failed: %s\n", strerror(errno));
+		}
+	}
 	/* There is no need to restore the signal handler here, since the app
 	 * is going to exit */
 }
@@ -1819,7 +1825,7 @@
 		return NULL;
 	}
 

[... 2296 lines stripped ...]



More information about the asterisk-commits mailing list