[asterisk-commits] tilghman: branch tilghman/adaptive_realtime r118822 - /team/tilghman/adaptive...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed May 28 15:57:51 CDT 2008


Author: tilghman
Date: Wed May 28 15:57:51 2008
New Revision: 118822

URL: http://svn.digium.com/view/asterisk?view=rev&rev=118822
Log:
Fix a few incorrect error messages and a crash

Modified:
    team/tilghman/adaptive_realtime/res/res_config_pgsql.c

Modified: team/tilghman/adaptive_realtime/res/res_config_pgsql.c
URL: http://svn.digium.com/view/asterisk/team/tilghman/adaptive_realtime/res/res_config_pgsql.c?view=diff&rev=118822&r1=118821&r2=118822
==============================================================================
--- team/tilghman/adaptive_realtime/res/res_config_pgsql.c (original)
+++ team/tilghman/adaptive_realtime/res/res_config_pgsql.c Wed May 28 15:57:51 2008
@@ -919,6 +919,7 @@
 
 	if (!table) {
 		ast_log(LOG_WARNING, "Table %s not found in database.  This table should exist if you're using realtime.\n", tablename);
+		return -1;
 	}
 
 	while ((elm = va_arg(ap, char *))) {
@@ -927,9 +928,11 @@
 		AST_LIST_TRAVERSE(&table->columns, column, list) {
 			if (strcmp(column->name, elm) == 0) {
 				/* Char can hold anything, as long as it is large enough */
-				if ((strncmp(column->type, "char", 4) == 0 || strncmp(column->type, "varchar", 7) == 0) && (size > column->len)) {
-					ast_log(LOG_WARNING, "Column %s should be at least %d long, but is only %d long.\n", column->name, size, column->len);
-					res = -1;
+				if ((strncmp(column->type, "char", 4) == 0 || strncmp(column->type, "varchar", 7) == 0 || strcmp(column->type, "bpchar") == 0)) {
+					if ((size > column->len) && column->len != -1) {
+						ast_log(LOG_WARNING, "Column '%s' should be at least %d long, but is only %d long.\n", column->name, size, column->len);
+						res = -1;
+					}
 				} else if (strncmp(column->type, "int", 3) == 0) {
 					int typesize = atoi(column->type + 3);
 					/* Integers can hold only other integers */




More information about the asterisk-commits mailing list