[asterisk-commits] russell: branch bbryant/keyrotation r134921 - in /team/bbryant/keyrotation: ....
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Thu Jul 31 14:45:35 CDT 2008
Author: russell
Date: Thu Jul 31 14:45:34 2008
New Revision: 134921
URL: http://svn.digium.com/view/asterisk?view=rev&rev=134921
Log:
sync with trunk
Modified:
team/bbryant/keyrotation/ (props changed)
team/bbryant/keyrotation/apps/app_ices.c
team/bbryant/keyrotation/channels/iax2-parser.c
team/bbryant/keyrotation/res/res_config_sqlite.c
Propchange: team/bbryant/keyrotation/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.
Propchange: team/bbryant/keyrotation/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Thu Jul 31 14:45:34 2008
@@ -1,1 +1,1 @@
-/trunk:1-134869
+/trunk:1-134920
Modified: team/bbryant/keyrotation/apps/app_ices.c
URL: http://svn.digium.com/view/asterisk/team/bbryant/keyrotation/apps/app_ices.c?view=diff&rev=134921&r1=134920&r2=134921
==============================================================================
--- team/bbryant/keyrotation/apps/app_ices.c (original)
+++ team/bbryant/keyrotation/apps/app_ices.c Thu Jul 31 14:45:34 2008
@@ -45,8 +45,8 @@
#include "asterisk/translate.h"
#include "asterisk/app.h"
-#define ICES "/usr/bin/ices"
-#define LOCAL_ICES "/usr/local/bin/ices"
+#define path_BIN "/usr/bin/"
+#define path_LOCAL "/usr/local/bin/"
static char *app = "ICES";
@@ -55,7 +55,9 @@
static char *descrip =
" ICES(config.xml) Streams to an icecast server using ices\n"
"(available separately). A configuration file must be supplied\n"
-"for ices (see examples/asterisk-ices.conf). \n";
+"for ices (see contrib/asterisk-ices.xml). \n"
+"\n"
+"- ICES version 2 cient and server required.\n";
static int icesencode(char *filename, int fd)
@@ -73,13 +75,23 @@
ast_set_priority(0);
dup2(fd, STDIN_FILENO);
ast_close_fds_above_n(STDERR_FILENO);
- /* Most commonly installed in /usr/local/bin */
- execl(ICES, "ices", filename, (char *)NULL);
- /* But many places has it in /usr/bin */
- execl(LOCAL_ICES, "ices", filename, (char *)NULL);
- /* As a last-ditch effort, try to use PATH */
- execlp("ices", "ices", filename, (char *)NULL);
- ast_log(LOG_WARNING, "Execute of ices failed\n");
+
+ /* Most commonly installed in /usr/local/bin
+ * But many places has it in /usr/bin
+ * As a last-ditch effort, try to use PATH
+ */
+ execl(path_LOCAL "ices2", "ices", filename, NULL);
+ execl(path_BIN "ices2", "ices", filename, NULL);
+ execlp("ices2", "ices", filename, NULL);
+
+ ast_debug(1, "Couldn't find ices version 2, attempting to use ices version 1.");
+
+ execl(path_LOCAL "ices", "ices", filename, NULL);
+ execl(path_BIN "ices", "ices", filename, NULL);
+ execlp("ices", "ices", filename, NULL);
+
+ ast_log(LOG_WARNING, "Execute of ices failed, could not find command.\n");
+ close(fd);
_exit(0);
}
@@ -139,7 +151,6 @@
if (c)
*c = '\0';
res = icesencode(filename, fds[0]);
- close(fds[0]);
if (res >= 0) {
pid = res;
for (;;) {
@@ -170,6 +181,7 @@
ast_frfree(f);
}
}
+ close(fds[0]);
close(fds[1]);
if (pid > -1)
Modified: team/bbryant/keyrotation/channels/iax2-parser.c
URL: http://svn.digium.com/view/asterisk/team/bbryant/keyrotation/channels/iax2-parser.c?view=diff&rev=134921&r1=134920&r2=134921
==============================================================================
--- team/bbryant/keyrotation/channels/iax2-parser.c (original)
+++ team/bbryant/keyrotation/channels/iax2-parser.c Thu Jul 31 14:45:34 2008
@@ -999,7 +999,7 @@
#if !defined(LOW_MEMORY)
struct iax_frames *iax_frames = NULL;
- struct iax_frame *smallest;
+ struct iax_frame *smallest = NULL;
/* Attempt to get a frame from this thread's cache */
if ((iax_frames = ast_threadstorage_get(&frame_cache, sizeof(*iax_frames)))) {
Modified: team/bbryant/keyrotation/res/res_config_sqlite.c
URL: http://svn.digium.com/view/asterisk/team/bbryant/keyrotation/res/res_config_sqlite.c?view=diff&rev=134921&r1=134920&r2=134921
==============================================================================
--- team/bbryant/keyrotation/res/res_config_sqlite.c (original)
+++ team/bbryant/keyrotation/res/res_config_sqlite.c Thu Jul 31 14:45:34 2008
@@ -124,7 +124,7 @@
/*!
* Maximum number of loops before giving up executing a query. Calls to
- * sqlite_xxx() functions which can return SQLITE_BUSY or SQLITE_LOCKED
+ * sqlite_xxx() functions which can return SQLITE_BUSY
* are enclosed by RES_CONFIG_SQLITE_BEGIN and RES_CONFIG_SQLITE_END, e.g.
* <pre>
* char *errormsg;
@@ -157,7 +157,7 @@
* \see RES_CONFIG_SQLITE_MAX_LOOPS.
*/
#define RES_CONFIG_SQLITE_END(error) \
- if (error != SQLITE_BUSY && error != SQLITE_LOCKED) \
+ if (error != SQLITE_BUSY) \
break; \
usleep(1000); \
} \
@@ -775,7 +775,7 @@
static int cdr_handler(struct ast_cdr *cdr)
{
- char *errormsg, *tmp, workspace[500];
+ char *errormsg = NULL, *tmp, workspace[500];
int error, scannum;
struct sqlite_cache_tables *tbl = find_table(cdr_table);
struct sqlite_cache_columns *col;
@@ -830,10 +830,11 @@
ast_free(sql1);
if (error) {
- ast_log(LOG_ERROR, "%s\n", errormsg);
+ ast_log(LOG_ERROR, "%s\n", S_OR(errormsg, sqlite_error_string(error)));
sqlite_freemem(errormsg);
return 1;
}
+ sqlite_freemem(errormsg);
return 0;
}
@@ -901,7 +902,7 @@
struct ast_config *cfg, struct ast_flags flags, const char *suggested_incl, const char *who_asked)
{
struct cfg_entry_args args;
- char *query, *errormsg;
+ char *query, *errormsg = NULL;
int error;
if (!config_table) {
@@ -938,10 +939,11 @@
sqlite_freemem(query);
if (error) {
- ast_log(LOG_ERROR, "%s\n", errormsg);
+ ast_log(LOG_ERROR, "%s\n", S_OR(errormsg, sqlite_error_string(error)));
sqlite_freemem(errormsg);
return NULL;
}
+ sqlite_freemem(errormsg);
return cfg;
}
@@ -1015,7 +1017,7 @@
static struct ast_variable * realtime_handler(const char *database, const char *table, va_list ap)
{
- char *query, *errormsg, *op, *tmp_str;
+ char *query, *errormsg = NULL, *op, *tmp_str;
struct rt_cfg_entry_args args;
const char **params, **vals;
size_t params_count;
@@ -1093,11 +1095,12 @@
sqlite_freemem(query);
if (error) {
- ast_log(LOG_WARNING, "%s\n", errormsg);
+ ast_log(LOG_WARNING, "%s\n", S_OR(errormsg, sqlite_error_string(error)));
sqlite_freemem(errormsg);
ast_variables_destroy(args.var);
return NULL;
}
+ sqlite_freemem(errormsg);
return args.var;
}
@@ -1153,7 +1156,7 @@
static struct ast_config *realtime_multi_handler(const char *database,
const char *table, va_list ap)
{
- char *query, *errormsg, *op, *tmp_str, *initfield;
+ char *query, *errormsg = NULL, *op, *tmp_str, *initfield;
struct rt_multi_cfg_entry_args args;
const char **params, **vals;
struct ast_config *cfg;
@@ -1259,11 +1262,12 @@
ast_free(initfield);
if (error) {
- ast_log(LOG_WARNING, "%s\n", errormsg);
+ ast_log(LOG_WARNING, "%s\n", S_OR(errormsg, sqlite_error_string(error)));
sqlite_freemem(errormsg);
ast_config_destroy(cfg);
return NULL;
}
+ sqlite_freemem(errormsg);
return cfg;
}
@@ -1271,7 +1275,7 @@
static int realtime_update_handler(const char *database, const char *table,
const char *keyfield, const char *entity, va_list ap)
{
- char *query, *errormsg, *tmp_str;
+ char *query, *errormsg = NULL, *tmp_str;
const char **params, **vals;
size_t params_count;
int error, rows_num;
@@ -1343,16 +1347,16 @@
sqlite_freemem(query);
if (error) {
- ast_log(LOG_WARNING, "%s\n", errormsg);
- sqlite_freemem(errormsg);
- }
+ ast_log(LOG_WARNING, "%s\n", S_OR(errormsg, sqlite_error_string(error)));
+ }
+ sqlite_freemem(errormsg);
return rows_num;
}
static int realtime_store_handler(const char *database, const char *table, va_list ap)
{
- char *errormsg, *tmp_str, *tmp_keys = NULL, *tmp_keys2 = NULL, *tmp_vals = NULL, *tmp_vals2 = NULL;
+ char *errormsg = NULL, *tmp_str, *tmp_keys = NULL, *tmp_keys2 = NULL, *tmp_vals = NULL, *tmp_vals2 = NULL;
const char **params, **vals;
size_t params_count;
int error, rows_id;
@@ -1437,9 +1441,9 @@
sqlite_freemem(tmp_str);
if (error) {
- ast_log(LOG_WARNING, "%s\n", errormsg);
- sqlite_freemem(errormsg);
- }
+ ast_log(LOG_WARNING, "%s\n", S_OR(errormsg, sqlite_error_string(error)));
+ }
+ sqlite_freemem(errormsg);
return rows_id;
}
@@ -1447,7 +1451,7 @@
static int realtime_destroy_handler(const char *database, const char *table,
const char *keyfield, const char *entity, va_list ap)
{
- char *query, *errormsg, *tmp_str;
+ char *query, *errormsg = NULL, *tmp_str;
const char **params, **vals;
size_t params_count;
int error, rows_num;
@@ -1514,9 +1518,9 @@
sqlite_freemem(query);
if (error) {
- ast_log(LOG_WARNING, "%s\n", errormsg);
- sqlite_freemem(errormsg);
- }
+ ast_log(LOG_WARNING, "%s\n", S_OR(errormsg, sqlite_error_string(error)));
+ }
+ sqlite_freemem(errormsg);
return rows_num;
}
@@ -1664,7 +1668,7 @@
static int load_module(void)
{
- char *errormsg;
+ char *errormsg = NULL;
int error;
db = NULL;
@@ -1679,12 +1683,14 @@
return AST_MODULE_LOAD_DECLINE;
if (!(db = sqlite_open(dbfile, 0660, &errormsg))) {
- ast_log(LOG_ERROR, "%s\n", errormsg);
+ ast_log(LOG_ERROR, "%s\n", S_OR(errormsg, sqlite_error_string(error)));
sqlite_freemem(errormsg);
unload_module();
return 1;
}
+ sqlite_freemem(errormsg);
+ errormsg = NULL;
ast_config_engine_register(&sqlite_engine);
if (use_cdr) {
@@ -1716,13 +1722,14 @@
* Unexpected error.
*/
if (error != SQLITE_ERROR) {
- ast_log(LOG_ERROR, "%s\n", errormsg);
+ ast_log(LOG_ERROR, "%s\n", S_OR(errormsg, sqlite_error_string(error)));
sqlite_freemem(errormsg);
unload_module();
return 1;
}
sqlite_freemem(errormsg);
+ errormsg = NULL;
query = sqlite_mprintf(sql_create_cdr_table, cdr_table);
if (!query) {
@@ -1740,12 +1747,14 @@
sqlite_freemem(query);
if (error) {
- ast_log(LOG_ERROR, "%s\n", errormsg);
+ ast_log(LOG_ERROR, "%s\n", S_OR(errormsg, sqlite_error_string(error)));
sqlite_freemem(errormsg);
unload_module();
return 1;
}
}
+ sqlite_freemem(errormsg);
+ errormsg = NULL;
error = ast_cdr_register(RES_CONFIG_SQLITE_NAME, RES_CONFIG_SQLITE_DESCRIPTION, cdr_handler);
More information about the asterisk-commits
mailing list