[asterisk-commits] kpfleming: branch kpfleming/aligner2 r153824 - in /team/kpfleming/aligner2: ....
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon Nov 3 07:03:15 CST 2008
Author: kpfleming
Date: Mon Nov 3 07:03:15 2008
New Revision: 153824
URL: http://svn.digium.com/view/asterisk?view=rev&rev=153824
Log:
------------------------------------------------------------------------
r153709 | kpfleming | 2008-11-02 17:34:39 -0600 (Sun, 02 Nov 2008) | 3 lines
instead of trying to forcibly load res_agi when app_stack is loaded (even if the administrator didn't want it loaded), use GCC weak symbols to determine whether it was loaded already or not; if it was loaded, then use it.
------------------------------------------------------------------------
Modified:
team/kpfleming/aligner2/ (props changed)
team/kpfleming/aligner2/channels/chan_dahdi.c
team/kpfleming/aligner2/channels/chan_oss.c
team/kpfleming/aligner2/funcs/func_odbc.c
team/kpfleming/aligner2/main/file.c
team/kpfleming/aligner2/main/http.c
team/kpfleming/aligner2/main/utils.c
team/kpfleming/aligner2/pbx/pbx_config.c
team/kpfleming/aligner2/res/res_jabber.c
Propchange: team/kpfleming/aligner2/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Mon Nov 3 07:03:15 2008
@@ -1,1 +1,1 @@
-/branches/1.4:1-153672
+/branches/1.4:1-153672,153823
Modified: team/kpfleming/aligner2/channels/chan_dahdi.c
URL: http://svn.digium.com/view/asterisk/team/kpfleming/aligner2/channels/chan_dahdi.c?view=diff&rev=153824&r1=153823&r2=153824
==============================================================================
--- team/kpfleming/aligner2/channels/chan_dahdi.c (original)
+++ team/kpfleming/aligner2/channels/chan_dahdi.c Mon Nov 3 07:03:15 2008
@@ -9728,7 +9728,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: team/kpfleming/aligner2/channels/chan_oss.c
URL: http://svn.digium.com/view/asterisk/team/kpfleming/aligner2/channels/chan_oss.c?view=diff&rev=153824&r1=153823&r2=153824
==============================================================================
--- team/kpfleming/aligner2/channels/chan_oss.c (original)
+++ team/kpfleming/aligner2/channels/chan_oss.c Mon Nov 3 07:03:15 2008
@@ -1792,12 +1792,15 @@
if (o->mixer_cmd) {
char *cmd;
- asprintf(&cmd, "mixer %s", o->mixer_cmd);
- ast_log(LOG_WARNING, "running [%s]\n", cmd);
- if (system(cmd) < 0) {
- ast_log(LOG_WARNING, "system() failed: %s\n", strerror(errno));
- }
- 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));
+ }
+ free(cmd);
+ }
}
if (o == &oss_default) /* we are done with the default */
return NULL;
Modified: team/kpfleming/aligner2/funcs/func_odbc.c
URL: http://svn.digium.com/view/asterisk/team/kpfleming/aligner2/funcs/func_odbc.c?view=diff&rev=153824&r1=153823&r2=153824
==============================================================================
--- team/kpfleming/aligner2/funcs/func_odbc.c (original)
+++ team/kpfleming/aligner2/funcs/func_odbc.c Mon Nov 3 07:03:15 2008
@@ -39,6 +39,7 @@
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
+#include <errno.h>
#include "asterisk/module.h"
#include "asterisk/file.h"
@@ -405,6 +406,7 @@
static int init_acf_query(struct ast_config *cfg, char *catg, struct acf_odbc_query **query)
{
const char *tmp;
+ int res;
if (!cfg || !catg) {
return -1;
@@ -449,9 +451,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)) {
@@ -461,7 +467,10 @@
return -1;
}
- 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)) {
free((char *)(*query)->acf->name);
@@ -471,36 +480,42 @@
return -1;
}
+ res = 0;
(*query)->acf->synopsis = "Runs the referenced query with the specified arguments";
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_log(LOG_ERROR, "No SQL was found for func_odbc class '%s'\n", catg);
}
+ if (res < 0) {
+ ast_log(LOG_WARNING, "asprintf() failed: %s\n", strerror(errno));
+ (*query)->acf->desc = NULL;
+ }
+
/* Could be out of memory, or could be we have neither sql_read nor sql_write */
- if (! ((*query)->acf->desc)) {
+ if (!((*query)->acf->desc)) {
free((char *)(*query)->acf->syntax);
free((char *)(*query)->acf->name);
free((*query)->acf);
Modified: team/kpfleming/aligner2/main/file.c
URL: http://svn.digium.com/view/asterisk/team/kpfleming/aligner2/main/file.c?view=diff&rev=153824&r1=153823&r2=153824
==============================================================================
--- team/kpfleming/aligner2/main/file.c (original)
+++ team/kpfleming/aligner2/main/file.c Mon Nov 3 07:03:15 2008
@@ -265,11 +265,18 @@
if (!strcmp(ext, "wav49"))
ext = "WAV";
- if (filename[0] == '/')
- asprintf(&fn, "%s.%s", filename, ext);
- else
- asprintf(&fn, "%s/sounds/%s.%s",
- ast_config_AST_DATA_DIR, filename, ext);
+ if (filename[0] == '/') {
+ if (asprintf(&fn, "%s.%s", filename, ext) < 0) {
+ ast_log(LOG_WARNING, "asprintf() failed: %s\n", strerror(errno));
+ fn = NULL;
+ }
+ } else {
+ if (asprintf(&fn, "%s/sounds/%s.%s",
+ ast_config_AST_DATA_DIR, filename, ext) < 0) {
+ ast_log(LOG_WARNING, "asprintf() failed: %s\n", strerror(errno));
+ fn = NULL;
+ }
+ }
return fn;
}
Modified: team/kpfleming/aligner2/main/http.c
URL: http://svn.digium.com/view/asterisk/team/kpfleming/aligner2/main/http.c?view=diff&rev=153824&r1=153823&r2=153824
==============================================================================
--- team/kpfleming/aligner2/main/http.c (original)
+++ team/kpfleming/aligner2/main/http.c Mon Nov 3 07:03:15 2008
@@ -231,20 +231,23 @@
char *ast_http_error(int status, const char *title, const char *extra_header, const char *text)
{
char *c = NULL;
- asprintf(&c,
- "Content-type: text/html\r\n"
- "%s"
- "\r\n"
- "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">\r\n"
- "<html><head>\r\n"
- "<title>%d %s</title>\r\n"
- "</head><body>\r\n"
- "<h1>%s</h1>\r\n"
- "<p>%s</p>\r\n"
- "<hr />\r\n"
- "<address>Asterisk Server</address>\r\n"
- "</body></html>\r\n",
- (extra_header ? extra_header : ""), status, title, title, text);
+ if (asprintf(&c,
+ "Content-type: text/html\r\n"
+ "%s"
+ "\r\n"
+ "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">\r\n"
+ "<html><head>\r\n"
+ "<title>%d %s</title>\r\n"
+ "</head><body>\r\n"
+ "<h1>%s</h1>\r\n"
+ "<p>%s</p>\r\n"
+ "<hr />\r\n"
+ "<address>Asterisk Server</address>\r\n"
+ "</body></html>\r\n",
+ (extra_header ? extra_header : ""), status, title, title, text) < 0) {
+ ast_log(LOG_WARNING, "asprintf() failed: %s\n", strerror(errno));
+ c = NULL;
+ }
return c;
}
Modified: team/kpfleming/aligner2/main/utils.c
URL: http://svn.digium.com/view/asterisk/team/kpfleming/aligner2/main/utils.c?view=diff&rev=153824&r1=153823&r2=153824
==============================================================================
--- team/kpfleming/aligner2/main/utils.c (original)
+++ team/kpfleming/aligner2/main/utils.c Mon Nov 3 07:03:15 2008
@@ -954,8 +954,11 @@
a->start_routine = start_routine;
a->data = data;
start_routine = dummy_start;
- asprintf(&a->name, "%-20s started at [%5d] %s %s()",
- start_fn, line, file, caller);
+ if (asprintf(&a->name, "%-20s started at [%5d] %s %s()",
+ start_fn, line, file, caller) < 0) {
+ ast_log(LOG_WARNING, "asprintf() failed: %s\n", strerror(errno));
+ a->name = NULL;
+ }
data = a;
}
#endif /* !LOW_MEMORY */
Modified: team/kpfleming/aligner2/pbx/pbx_config.c
URL: http://svn.digium.com/view/asterisk/team/kpfleming/aligner2/pbx/pbx_config.c?view=diff&rev=153824&r1=153823&r2=153824
==============================================================================
--- team/kpfleming/aligner2/pbx/pbx_config.c (original)
+++ team/kpfleming/aligner2/pbx/pbx_config.c Mon Nov 3 07:03:15 2008
@@ -723,10 +723,16 @@
if (++which > state) {
/* If there is an extension then return exten at context. */
if (ast_get_extension_matchcid(e) && (!strchr(word, '@') || strchr(word, '/'))) {
- asprintf(&ret, "%s/%s@%s", ast_get_extension_name(e), ast_get_extension_cidmatch(e), ast_get_context_name(c));
+ if (asprintf(&ret, "%s/%s@%s", ast_get_extension_name(e), ast_get_extension_cidmatch(e), ast_get_context_name(c)) < 0) {
+ ast_log(LOG_WARNING, "asprintf() failed: %s\n", strerror(errno));
+ ret = NULL;
+ }
break;
} else if (!ast_get_extension_matchcid(e) && !strchr(word, '/')) {
- asprintf(&ret, "%s@%s", ast_get_extension_name(e), ast_get_context_name(c));
+ if (asprintf(&ret, "%s@%s", ast_get_extension_name(e), ast_get_context_name(c)) < 0) {
+ ast_log(LOG_WARNING, "asprintf() failed: %s\n", strerror(errno));
+ ret = NULL;
+ }
break;
}
}
@@ -863,10 +869,16 @@
if (++which > state) {
/* If there is an extension then return exten at context. */
if (ast_get_extension_matchcid(e) && (!strchr(word, '@') || strchr(word, '/'))) {
- asprintf(&ret, "%s/%s@%s", ast_get_extension_name(e), ast_get_extension_cidmatch(e), ast_get_context_name(c));
+ if (asprintf(&ret, "%s/%s@%s", ast_get_extension_name(e), ast_get_extension_cidmatch(e), ast_get_context_name(c)) < 0) {
+ ast_log(LOG_WARNING, "asprintf() failed: %s\n", strerror(errno));
+ ret = NULL;
+ }
break;
} else if (!ast_get_extension_matchcid(e) && !strchr(word, '/')) {
- asprintf(&ret, "%s@%s", ast_get_extension_name(e), ast_get_context_name(c));
+ if (asprintf(&ret, "%s@%s", ast_get_extension_name(e), ast_get_context_name(c)) < 0) {
+ ast_log(LOG_WARNING, "asprintf() failed: %s\n", strerror(errno));
+ ret = NULL;
+ }
break;
}
}
Modified: team/kpfleming/aligner2/res/res_jabber.c
URL: http://svn.digium.com/view/asterisk/team/kpfleming/aligner2/res/res_jabber.c?view=diff&rev=153824&r1=153823&r2=153824
==============================================================================
--- team/kpfleming/aligner2/res/res_jabber.c (original)
+++ team/kpfleming/aligner2/res/res_jabber.c Mon Nov 3 07:03:15 2008
@@ -629,8 +629,7 @@
sprintf(secret, "%s%s", pak->id, client->password);
ast_sha1_hash(shasum, secret);
handshake = NULL;
- asprintf(&handshake, "<handshake>%s</handshake>", shasum);
- if (handshake) {
+ if (asprintf(&handshake, "<handshake>%s</handshake>", shasum) > 0) {
iks_send_raw(client->p, handshake);
free(handshake);
handshake = NULL;
@@ -2205,8 +2204,7 @@
}
if (!strchr(client->user, '/') && !client->component) { /*client */
resource = NULL;
- asprintf(&resource, "%s/asterisk", client->user);
- if (resource) {
+ if (asprintf(&resource, "%s/asterisk", client->user) > 0) {
client->jid = iks_id_new(client->stack, resource);
free(resource);
}
@@ -2222,8 +2220,7 @@
}
if (!strchr(client->user, '/') && !client->component) { /*client */
resource = NULL;
- asprintf(&resource, "%s/asterisk", client->user);
- if (resource) {
+ if (asprintf(&resource, "%s/asterisk", client->user) > 0) {
client->jid = iks_id_new(client->stack, resource);
free(resource);
}
More information about the asterisk-commits
mailing list