summaryrefslogtreecommitdiff
path: root/res
diff options
context:
space:
mode:
Diffstat (limited to 'res')
-rw-r--r--res/res_calendar.c2
-rw-r--r--res/res_config_pgsql.c2
-rw-r--r--res/res_monitor.c41
3 files changed, 22 insertions, 23 deletions
diff --git a/res/res_calendar.c b/res/res_calendar.c
index 3725c9435..298970a92 100644
--- a/res/res_calendar.c
+++ b/res/res_calendar.c
@@ -735,7 +735,7 @@ static void *do_notify(void *data)
struct ast_channel *chan = NULL;
struct ast_variable *itervar;
char *tech, *dest;
- char buf[8];
+ char buf[33];
struct ast_format_cap *caps;
tech = ast_strdupa(event->owner->notify_channel);
diff --git a/res/res_config_pgsql.c b/res/res_config_pgsql.c
index e74b73036..b0a24c464 100644
--- a/res/res_config_pgsql.c
+++ b/res/res_config_pgsql.c
@@ -1329,7 +1329,7 @@ static int require_pgsql(const char *database, const char *tablename, va_list ap
/* Size is minimum length; make it at least 50% greater,
* just to be sure, because PostgreSQL doesn't support
* resizing columns. */
- snprintf(fieldtype, sizeof(fieldtype), "CHAR(%d)",
+ snprintf(fieldtype, sizeof(fieldtype), "CHAR(%hhu)",
size < 15 ? size * 2 :
(size * 3 / 2 > 255) ? 255 : size * 3 / 2);
} else if (type == RQ_INTEGER1 || type == RQ_UINTEGER1 || type == RQ_INTEGER2) {
diff --git a/res/res_monitor.c b/res/res_monitor.c
index ebf98439c..7ec1bb6c5 100644
--- a/res/res_monitor.c
+++ b/res/res_monitor.c
@@ -460,7 +460,7 @@ int AST_OPTIONAL_API_NAME(ast_monitor_stop)(struct ast_channel *chan, int need_l
LOCK_IF_NEEDED(chan, need_lock);
if (ast_channel_monitor(chan)) {
- char filename[ FILENAME_MAX ];
+ RAII_VAR(struct ast_str *, tmp, ast_str_create(1024), ast_free);
if (ast_channel_monitor(chan)->read_stream) {
ast_closestream(ast_channel_monitor(chan)->read_stream);
@@ -469,31 +469,29 @@ int AST_OPTIONAL_API_NAME(ast_monitor_stop)(struct ast_channel *chan, int need_l
ast_closestream(ast_channel_monitor(chan)->write_stream);
}
- if (ast_channel_monitor(chan)->filename_changed && !ast_strlen_zero(ast_channel_monitor(chan)->filename_base)) {
+ if (tmp && ast_channel_monitor(chan)->filename_changed && !ast_strlen_zero(ast_channel_monitor(chan)->filename_base)) {
if (ast_fileexists(ast_channel_monitor(chan)->read_filename,NULL,NULL) > 0) {
- snprintf(filename, FILENAME_MAX, "%s-in", ast_channel_monitor(chan)->filename_base);
- if (ast_fileexists(filename, NULL, NULL) > 0) {
- ast_filedelete(filename, NULL);
+ ast_str_set(&tmp, 0, "%s-in", ast_channel_monitor(chan)->filename_base);
+ if (ast_fileexists(ast_str_buffer(tmp), NULL, NULL) > 0) {
+ ast_filedelete(ast_str_buffer(tmp), NULL);
}
- ast_filerename(ast_channel_monitor(chan)->read_filename, filename, ast_channel_monitor(chan)->format);
+ ast_filerename(ast_channel_monitor(chan)->read_filename, ast_str_buffer(tmp), ast_channel_monitor(chan)->format);
} else {
ast_log(LOG_WARNING, "File %s not found\n", ast_channel_monitor(chan)->read_filename);
}
- if (ast_fileexists(ast_channel_monitor(chan)->write_filename,NULL,NULL) > 0) {
- snprintf(filename, FILENAME_MAX, "%s-out", ast_channel_monitor(chan)->filename_base);
- if (ast_fileexists(filename, NULL, NULL) > 0) {
- ast_filedelete(filename, NULL);
+ if (tmp && ast_fileexists(ast_channel_monitor(chan)->write_filename,NULL,NULL) > 0) {
+ ast_str_set(&tmp, 0, "%s-out", ast_channel_monitor(chan)->filename_base);
+ if (ast_fileexists(ast_str_buffer(tmp), NULL, NULL) > 0) {
+ ast_filedelete(ast_str_buffer(tmp), NULL);
}
- ast_filerename(ast_channel_monitor(chan)->write_filename, filename, ast_channel_monitor(chan)->format);
+ ast_filerename(ast_channel_monitor(chan)->write_filename, ast_str_buffer(tmp), ast_channel_monitor(chan)->format);
} else {
ast_log(LOG_WARNING, "File %s not found\n", ast_channel_monitor(chan)->write_filename);
}
}
- if (ast_channel_monitor(chan)->joinfiles && !ast_strlen_zero(ast_channel_monitor(chan)->filename_base)) {
- char tmp[1024];
- char tmp2[1024];
+ if (tmp && ast_channel_monitor(chan)->joinfiles && !ast_strlen_zero(ast_channel_monitor(chan)->filename_base)) {
const char *format = !strcasecmp(ast_channel_monitor(chan)->format,"wav49") ? "WAV" : ast_channel_monitor(chan)->format;
char *fname_base = ast_channel_monitor(chan)->filename_base;
const char *execute, *execute_args;
@@ -514,16 +512,17 @@ int AST_OPTIONAL_API_NAME(ast_monitor_stop)(struct ast_channel *chan, int need_l
if (ast_strlen_zero(execute_args)) {
execute_args = "";
}
-
- snprintf(tmp, sizeof(tmp), "%s \"%s-in.%s\" \"%s-out.%s\" \"%s.%s\" %s &",
+
+ ast_str_set(&tmp, 0, delfiles ? "( " : "");
+ ast_str_append(&tmp, 0, "%s \"%s-in.%s\" \"%s-out.%s\" \"%s.%s\" %s &",
execute, fname_base, format, fname_base, format, fname_base, format,execute_args);
if (delfiles) {
- snprintf(tmp2,sizeof(tmp2), "( %s& rm -f \"%s-\"* ) &",tmp, fname_base); /* remove legs when done mixing */
- ast_copy_string(tmp, tmp2, sizeof(tmp));
+ /* remove legs when done mixing */
+ ast_str_append(&tmp, 0, "& rm -f \"%s-\"* ) &", fname_base);
}
- ast_debug(1,"monitor executing %s\n",tmp);
- if (ast_safe_system(tmp) == -1)
- ast_log(LOG_WARNING, "Execute of %s failed.\n",tmp);
+ ast_debug(1,"monitor executing %s\n", ast_str_buffer(tmp));
+ if (ast_safe_system(ast_str_buffer(tmp)) == -1)
+ ast_log(LOG_WARNING, "Execute of %s failed.\n", ast_str_buffer(tmp));
}
if (!ast_strlen_zero(ast_channel_monitor(chan)->beep_id)) {