<p>Corey Farrell has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/6116">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">Fix compiler warnings on Fedora 26 / GCC 7.<br><br>GCC 7 has added capability to produce warnings, this fixes most of those<br>warnings. The specific warnings are disabled in a few places:<br><br>* app_voicemail.c: truncation of paths more than 4096 chars in many places.<br>* chan_mgcp.c: callid truncated to 80 chars.<br>* cdr.c: two userfields are combined to cdr copy, fix would break ABI.<br>* tcptls.c: ignore use of deprecated method SSLv3_client_method().<br><br>ASTERISK-27156 #close<br><br>Change-Id: I65f280e7d3cfad279d16f41823a4d6fddcbc4c88<br>---<br>M apps/Makefile<br>M apps/app_chanspy.c<br>M apps/app_followme.c<br>M apps/app_minivm.c<br>M apps/app_queue.c<br>M apps/app_voicemail.c<br>M channels/Makefile<br>M channels/chan_iax2.c<br>M channels/chan_motif.c<br>M channels/chan_sip.c<br>M channels/chan_unistim.c<br>M channels/iax2/firmware.c<br>M main/Makefile<br>M main/ast_expr2.c<br>M main/ast_expr2.y<br>M main/asterisk.c<br>M main/ccss.c<br>M main/cli.c<br>M main/editline/term.c<br>M main/libasteriskssl.c<br>M main/manager.c<br>M main/stdtime/localtime.c<br>M main/utils.c<br>M res/res_calendar.c<br>M res/res_monitor.c<br>25 files changed, 66 insertions(+), 63 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/16/6116/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/apps/Makefile b/apps/Makefile<br>index 7730460..d688173 100644<br>--- a/apps/Makefile<br>+++ b/apps/Makefile<br>@@ -29,6 +29,8 @@<br> <br> $(call MOD_ADD_C,app_confbridge,$(wildcard confbridge/*.c))<br> <br>+app_voicemail.o: _ASTCFLAGS+=-Wno-format-truncation<br>+<br> ifneq ($(findstring $(OSARCH), mingw32 cygwin ),)<br> LIBS+= -lres_ael_share.so -lres_monitor.so -lres_speech.so<br> LIBS+= -lres_smdi.so<br>diff --git a/apps/app_chanspy.c b/apps/app_chanspy.c<br>index 354b9ea..95ebace 100644<br>--- a/apps/app_chanspy.c<br>+++ b/apps/app_chanspy.c<br>@@ -1442,7 +1442,7 @@<br> static int dahdiscan_exec(struct ast_channel *chan, const char *data)<br> {<br> const char *spec = "DAHDI";<br>- struct ast_flags flags;<br>+ struct ast_flags flags = {0};<br> struct spy_dtmf_options user_options = {<br> .cycle = '#',<br> .volume = '\0',<br>diff --git a/apps/app_followme.c b/apps/app_followme.c<br>index 72afa3d..578118a 100644<br>--- a/apps/app_followme.c<br>+++ b/apps/app_followme.c<br>@@ -1558,7 +1558,7 @@<br> }<br> if (!ast_strlen_zero(targs->namerecloc)) {<br> int ret;<br>- char fn[PATH_MAX];<br>+ char fn[PATH_MAX + sizeof(REC_FORMAT)];<br> <br> snprintf(fn, sizeof(fn), "%s.%s", targs->namerecloc,<br> REC_FORMAT);<br>diff --git a/apps/app_minivm.c b/apps/app_minivm.c<br>index ff9ab34..9359f82 100644<br>--- a/apps/app_minivm.c<br>+++ b/apps/app_minivm.c<br>@@ -2251,7 +2251,7 @@<br> char ecodes[16] = "#";<br> char *tmpptr;<br> struct minivm_account *vmu;<br>- char *username = argv[0];<br>+ char *username;<br> <br> if (ast_strlen_zero(data)) {<br> ast_log(LOG_ERROR, "Minivm needs at least an account argument \n");<br>diff --git a/apps/app_queue.c b/apps/app_queue.c<br>index 762119e..0b70108 100644<br>--- a/apps/app_queue.c<br>+++ b/apps/app_queue.c<br>@@ -6601,7 +6601,7 @@<br> char oldexten[AST_MAX_EXTENSION]="";<br> char oldcontext[AST_MAX_CONTEXT]="";<br> char queuename[256]="";<br>- char interfacevar[256]="";<br>+ char interfacevar[325]="";<br> struct ast_channel *peer;<br> struct ast_channel *which;<br> struct callattempt *lpeer;<br>diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c<br>index 0a07cc1..5f82128 100644<br>--- a/apps/app_voicemail.c<br>+++ b/apps/app_voicemail.c<br>@@ -7913,7 +7913,7 @@<br> <br> *duration += prepend_duration;<br> msg_cat = ast_category_get(msg_cfg, "message", NULL);<br>- snprintf(duration_buf, 11, "%ld", *duration);<br>+ snprintf(duration_buf, sizeof(duration_buf), "%ld", *duration);<br> if (!ast_variable_update(msg_cat, "duration", duration_buf, NULL, 0)) {<br> ast_config_text_file_save(textfile, msg_cfg, "app_voicemail");<br> }<br>@@ -8685,7 +8685,7 @@<br> static int play_message(struct ast_channel *chan, struct ast_vm_user *vmu, struct vm_state *vms)<br> {<br> int res = 0;<br>- char filename[256], *cid;<br>+ char filename[PATH_MAX], *cid;<br> const char *origtime, *context, *category, *duration, *flag;<br> struct ast_config *msg_cfg;<br> struct ast_flags config_flags = { CONFIG_FLAG_NOCACHE };<br>diff --git a/channels/Makefile b/channels/Makefile<br>index 44a0429..ae7107f 100644<br>--- a/channels/Makefile<br>+++ b/channels/Makefile<br>@@ -29,6 +29,8 @@<br> $(call MOD_ADD_C,chan_dahdi,$(wildcard dahdi/*.c) sig_analog.c sig_pri.c sig_ss7.c)<br> $(call MOD_ADD_C,chan_misdn,misdn_config.c misdn/isdn_lib.c misdn/isdn_msg_parser.c)<br> <br>+chan_mgcp.o: _ASTCFLAGS+=-Wno-format-truncation<br>+<br> chan_misdn.o: _ASTCFLAGS+=-Imisdn<br> misdn_config.o: _ASTCFLAGS+=-Imisdn<br> misdn/isdn_lib.o: _ASTCFLAGS+=-Wno-strict-aliasing<br>diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c<br>index 5abb6c3..65cc79b 100644<br>--- a/channels/chan_iax2.c<br>+++ b/channels/chan_iax2.c<br>@@ -8545,7 +8545,7 @@<br> {<br> int newcall = 0;<br> struct iax_ie_data ied;<br>- struct ast_sockaddr new;<br>+ struct ast_sockaddr new = {0};<br> <br> memset(&ied, 0, sizeof(ied));<br> if (!ast_sockaddr_isnull(&ies->apparent_addr)) {<br>diff --git a/channels/chan_motif.c b/channels/chan_motif.c<br>index 7d696e8..210cf36 100644<br>--- a/channels/chan_motif.c<br>+++ b/channels/chan_motif.c<br>@@ -1901,7 +1901,7 @@<br> {<br> RAII_VAR(struct jingle_config *, cfg, ao2_global_obj_ref(globals), ao2_cleanup);<br> RAII_VAR(struct jingle_endpoint *, endpoint, NULL, ao2_cleanup);<br>- char *dialed, target[200] = "";<br>+ char *dialed, target[1024] = "";<br> struct ast_xmpp_buddy *buddy;<br> struct jingle_session *session;<br> struct ast_channel *chan;<br>diff --git a/channels/chan_sip.c b/channels/chan_sip.c<br>index f2daf2b..3c1014d 100644<br>--- a/channels/chan_sip.c<br>+++ b/channels/chan_sip.c<br>@@ -2085,7 +2085,7 @@<br> static int construct_pidf_body(enum sip_cc_publish_state state, char *pidf_body, size_t size, const char *presentity)<br> {<br> struct ast_str *body = ast_str_alloca(size);<br>- char tuple_id[32];<br>+ char tuple_id[64];<br> <br> generate_random_string(tuple_id, sizeof(tuple_id));<br> <br>@@ -15333,7 +15333,7 @@<br> {<br> struct sip_request req;<br> struct sip_cc_agent_pvt *agent_pvt = agent->private_data;<br>- char uri[SIPBUFSIZE];<br>+ char uri[SIPBUFSIZE + 11];<br> char state_str[64];<br> char subscription_state_hdr[64];<br> <br>diff --git a/channels/chan_unistim.c b/channels/chan_unistim.c<br>index b820cf5..f124c0f 100644<br>--- a/channels/chan_unistim.c<br>+++ b/channels/chan_unistim.c<br>@@ -370,7 +370,7 @@<br> struct unistim_line {<br> ast_mutex_t lock;<br> char name[80]; /*! Like 200 */<br>- char fullname[80]; /*! Like USTM/200\@black */<br>+ char fullname[101]; /*! Like USTM/200\@black */<br> char exten[AST_MAX_EXTENSION]; /*! Extension where to start */<br> char cid_num[AST_MAX_EXTENSION]; /*! CallerID Number */<br> char mailbox[AST_MAX_EXTENSION]; /*! Mailbox for MWI */<br>@@ -3698,7 +3698,7 @@<br> #define SELECTCODEC_MSG "Codec number : .."<br> static void handle_select_codec(struct unistimsession *pte)<br> {<br>- char buf[30], buf2[5];<br>+ char buf[30], buf2[6];<br> <br> pte->state = STATE_SELECTCODEC;<br> ast_copy_string(buf, ustmtext("Using codec", pte), sizeof(buf));<br>diff --git a/channels/iax2/firmware.c b/channels/iax2/firmware.c<br>index 00a9d9e..10a0b92 100644<br>--- a/channels/iax2/firmware.c<br>+++ b/channels/iax2/firmware.c<br>@@ -206,7 +206,7 @@<br> struct iax_firmware *cur = NULL;<br> DIR *fwd;<br> struct dirent *de;<br>- char dir[256], fn[256];<br>+ char dir[256], fn[257];<br> <br> AST_LIST_LOCK(&firmwares);<br> <br>diff --git a/main/Makefile b/main/Makefile<br>index 4fb6a01..d816443 100644<br>--- a/main/Makefile<br>+++ b/main/Makefile<br>@@ -140,6 +140,7 @@<br> $(CMD_PREFIX) rm $@.fix<br> <br> ast_expr2f.o: _ASTCFLAGS+=-Wno-unused<br>+cdr.o: _ASTCFLAGS+=-Wno-format-truncation<br> <br> testexpr2: ast_expr2f.c ast_expr2.c ast_expr2.h<br> $(CC) -g -c -Iinclude -DSTANDALONE ast_expr2f.c<br>@@ -314,7 +315,7 @@<br> <br> endif<br> <br>-tcptls.o: _ASTCFLAGS+=$(OPENSSL_INCLUDE)<br>+tcptls.o: _ASTCFLAGS+=$(OPENSSL_INCLUDE) -Wno-deprecated-declarations<br> <br> $(MAIN_TGT): $(OBJS) $(ASTSSL_LIB) $(ASTPJ_LIB) $(LIBEDIT_OBJ)<br> @$(CC) -c -o buildinfo.o $(_ASTCFLAGS) buildinfo.c $(ASTCFLAGS)<br>diff --git a/main/ast_expr2.c b/main/ast_expr2.c<br>index 4b06ffe..00f17c5 100644<br>--- a/main/ast_expr2.c<br>+++ b/main/ast_expr2.c<br>@@ -2635,9 +2635,8 @@<br> if (vp->type == AST_EXPR_string || vp->type == AST_EXPR_numeric_string)<br> return;<br> <br>- tmp = malloc ((size_t)25);<br>- if (tmp == NULL) {<br>- ast_log(LOG_WARNING,"malloc() failed\n");<br>+ if (asprintf(&tmp, FP___PRINTF, vp->u.i) == -1) {<br>+ ast_log(LOG_WARNING, "asprintf() failed\n");<br> return;<br> }<br> <br>diff --git a/main/ast_expr2.y b/main/ast_expr2.y<br>index f516291..3c89430 100644<br>--- a/main/ast_expr2.y<br>+++ b/main/ast_expr2.y<br>@@ -628,13 +628,11 @@<br> if (vp->type == AST_EXPR_string || vp->type == AST_EXPR_numeric_string)<br> return;<br> <br>- tmp = malloc ((size_t)25);<br>- if (tmp == NULL) {<br>- ast_log(LOG_WARNING,"malloc() failed\n");<br>+ if (asprintf(&tmp, FP___PRINTF, vp->u.i) == -1) {<br>+ ast_log(LOG_WARNING, "asprintf() failed\n");<br> return;<br> }<br> <br>- sprintf(tmp, FP___PRINTF, vp->u.i);<br> vp->type = AST_EXPR_string;<br> vp->u.s = tmp;<br> }<br>diff --git a/main/asterisk.c b/main/asterisk.c<br>index a302836..a9186e6 100644<br>--- a/main/asterisk.c<br>+++ b/main/asterisk.c<br>@@ -397,8 +397,8 @@<br> char config_dir[PATH_MAX];<br> char module_dir[PATH_MAX];<br> char spool_dir[PATH_MAX];<br>- char monitor_dir[PATH_MAX];<br>- char recording_dir[PATH_MAX];<br>+ char monitor_dir[PATH_MAX + 8];<br>+ char recording_dir[PATH_MAX + 10];<br> char var_dir[PATH_MAX];<br> char data_dir[PATH_MAX];<br> char log_dir[PATH_MAX];<br>diff --git a/main/ccss.c b/main/ccss.c<br>index f96d7aa..a9d15b0 100644<br>--- a/main/ccss.c<br>+++ b/main/ccss.c<br>@@ -3546,7 +3546,7 @@<br> */<br> static void cc_unique_append(struct ast_str **str, const char *dialstring)<br> {<br>- char dialstring_search[AST_CHANNEL_NAME];<br>+ char dialstring_search[AST_CHANNEL_NAME + 1];<br> <br> if (ast_strlen_zero(dialstring)) {<br> /* No dialstring to append. */<br>diff --git a/main/cli.c b/main/cli.c<br>index 06f2d55..ef86e25 100644<br>--- a/main/cli.c<br>+++ b/main/cli.c<br>@@ -372,7 +372,7 @@<br> int i, count = 0;<br> unsigned int prospective[2];<br> unsigned int part = strtoul(partial, NULL, 10);<br>- char next[12];<br>+ char next[13];<br> <br> if (part < min || part > max) {<br> return NULL;<br>@@ -1031,7 +1031,7 @@<br> it_chans = ao2_iterator_init(channels, 0);<br> for (; (msg = ao2_iterator_next(&it_chans)); ao2_ref(msg, -1)) {<br> struct ast_channel_snapshot *cs = stasis_message_data(msg);<br>- char durbuf[10] = "-";<br>+ char durbuf[16] = "-";<br> <br> if (!count) {<br> if ((concise || verbose) && !ast_tvzero(cs->creationtime)) {<br>diff --git a/main/editline/term.c b/main/editline/term.c<br>index 00b68ed..4da4f0f 100644<br>--- a/main/editline/term.c<br>+++ b/main/editline/term.c<br>@@ -428,7 +428,7 @@<br> */<br> tlen = 0;<br> for (tmp = tlist; tmp < &tlist[T_str]; tmp++)<br>- if (*tmp != NULL && *tmp != '\0' && *tmp != *str) {<br>+ if (*tmp != NULL && *tmp[0] != '\0' && *tmp != *str) {<br> char *ptr;<br> <br> for (ptr = *tmp; *ptr != '\0'; termbuf[tlen++] = *ptr++)<br>diff --git a/main/libasteriskssl.c b/main/libasteriskssl.c<br>index 9da63de..8b19e24 100644<br>--- a/main/libasteriskssl.c<br>+++ b/main/libasteriskssl.c<br>@@ -29,19 +29,20 @@<br> <br> #include "asterisk.h"<br> <br>+#include "asterisk/_private.h" /* ast_ssl_init() */<br>+<br> #ifdef HAVE_OPENSSL<br> #include <openssl/ssl.h><br> #include <openssl/err.h><br> #endif<br> <br>-#include <dlfcn.h><br>+#if defined(HAVE_OPENSSL) && \<br>+ !defined(OPENSSL_VERSION_NUMBER) || OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)<br> <br>-#include "asterisk/_private.h" /* ast_ssl_init() */<br>+#include <dlfcn.h><br> <br> #include "asterisk/utils.h"<br> #include "asterisk/lock.h"<br>-<br>-#ifdef HAVE_OPENSSL<br> <br> #define get_OpenSSL_function(func) do { real_##func = dlsym(RTLD_NEXT, __stringify(func)); } while(0)<br> <br>@@ -72,7 +73,6 @@<br> }<br> }<br> <br>-#if !defined(OPENSSL_VERSION_NUMBER) || OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)<br> int SSL_library_init(void)<br> {<br> #if defined(AST_DEVMODE)<br>@@ -114,9 +114,6 @@<br> {<br> /* we can't allow this to be called, ever */<br> }<br>-#endif /* !defined(OPENSSL_VERSION_NUMBER) || OPENSSL_VERSION_NUMBER < 0x10100000L */<br>-<br>-#endif /* HAVE_OPENSSL */<br> <br> /*!<br> * \internal<br>@@ -126,8 +123,6 @@<br> */<br> int ast_ssl_init(void)<br> {<br>-#if defined(HAVE_OPENSSL) && defined(OPENSSL_VERSION_NUMBER) && \<br>- (OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER))<br> unsigned int i;<br> int (*real_SSL_library_init)(void);<br> void (*real_CRYPTO_set_id_callback)(unsigned long (*)(void));<br>@@ -192,7 +187,14 @@<br> <br> startup_complete = 1;<br> <br>-#endif /* HAVE_OPENSSL and its version < 1.1 */<br> return 0;<br> }<br> <br>+#else<br>+<br>+int ast_ssl_init(void)<br>+{<br>+ return 0;<br>+}<br>+<br>+#endif<br>diff --git a/main/manager.c b/main/manager.c<br>index 1bbd1bb..d16a692 100644<br>--- a/main/manager.c<br>+++ b/main/manager.c<br>@@ -6115,7 +6115,7 @@<br> for (; (msg = ao2_iterator_next(&it_chans)); ao2_ref(msg, -1)) {<br> struct ast_channel_snapshot *cs = stasis_message_data(msg);<br> struct ast_str *built = ast_manager_build_channel_state_string_prefix(cs, "");<br>- char durbuf[10] = "";<br>+ char durbuf[16] = "";<br> <br> if (!built) {<br> continue;<br>diff --git a/main/stdtime/localtime.c b/main/stdtime/localtime.c<br>index bb221ae..88b8020 100644<br>--- a/main/stdtime/localtime.c<br>+++ b/main/stdtime/localtime.c<br>@@ -2434,7 +2434,7 @@<br> cur = NULL;<br> AST_LIST_LOCK(&localelist);<br> for (x = 0; x < 10000; x++) {<br>- char name[5];<br>+ char name[6];<br> snprintf(name, sizeof(name), "%04d", x);<br> if (!find_by_name(name)) {<br> if ((cur = ast_calloc(1, sizeof(*cur) + strlen(name) + 1))) {<br>diff --git a/main/utils.c b/main/utils.c<br>index c254db5..de9f8bd 100644<br>--- a/main/utils.c<br>+++ b/main/utils.c<br>@@ -1490,7 +1490,7 @@<br> int found = 0;<br> char stack[8];<br> <br>- if (iss == NULL || *iss == '\0') {<br>+ if (iss == NULL || *iss[0] == '\0') {<br> return NULL;<br> }<br> <br>diff --git a/res/res_calendar.c b/res/res_calendar.c<br>index 666b0e1..9ce8159 100644<br>--- a/res/res_calendar.c<br>+++ b/res/res_calendar.c<br>@@ -741,7 +741,7 @@<br> struct ast_channel *chan = NULL;<br> struct ast_variable *itervar;<br> char *tech, *dest;<br>- char buf[8];<br>+ char buf[33];<br> struct ast_format_cap *caps;<br> <br> tech = ast_strdupa(event->owner->notify_channel);<br>diff --git a/res/res_monitor.c b/res/res_monitor.c<br>index 2ab52d8..fd3ff7a 100644<br>--- a/res/res_monitor.c<br>+++ b/res/res_monitor.c<br>@@ -457,7 +457,7 @@<br> LOCK_IF_NEEDED(chan, need_lock);<br> <br> if (ast_channel_monitor(chan)) {<br>- char filename[ FILENAME_MAX ];<br>+ RAII_VAR(struct ast_str *, tmp, ast_str_create(1024), ast_free);<br> <br> if (ast_channel_monitor(chan)->read_stream) {<br> ast_closestream(ast_channel_monitor(chan)->read_stream);<br>@@ -466,31 +466,29 @@<br> ast_closestream(ast_channel_monitor(chan)->write_stream);<br> }<br> <br>- if (ast_channel_monitor(chan)->filename_changed && !ast_strlen_zero(ast_channel_monitor(chan)->filename_base)) {<br>+ if (tmp && ast_channel_monitor(chan)->filename_changed && !ast_strlen_zero(ast_channel_monitor(chan)->filename_base)) {<br> if (ast_fileexists(ast_channel_monitor(chan)->read_filename,NULL,NULL) > 0) {<br>- snprintf(filename, FILENAME_MAX, "%s-in", ast_channel_monitor(chan)->filename_base);<br>- if (ast_fileexists(filename, NULL, NULL) > 0) {<br>- ast_filedelete(filename, NULL);<br>+ ast_str_set(&tmp, 0, "%s-in", ast_channel_monitor(chan)->filename_base);<br>+ if (ast_fileexists(ast_str_buffer(tmp), NULL, NULL) > 0) {<br>+ ast_filedelete(ast_str_buffer(tmp), NULL);<br> }<br>- ast_filerename(ast_channel_monitor(chan)->read_filename, filename, ast_channel_monitor(chan)->format);<br>+ ast_filerename(ast_channel_monitor(chan)->read_filename, ast_str_buffer(tmp), ast_channel_monitor(chan)->format);<br> } else {<br> ast_log(LOG_WARNING, "File %s not found\n", ast_channel_monitor(chan)->read_filename);<br> }<br> <br>- if (ast_fileexists(ast_channel_monitor(chan)->write_filename,NULL,NULL) > 0) {<br>- snprintf(filename, FILENAME_MAX, "%s-out", ast_channel_monitor(chan)->filename_base);<br>- if (ast_fileexists(filename, NULL, NULL) > 0) {<br>- ast_filedelete(filename, NULL);<br>+ if (tmp && ast_fileexists(ast_channel_monitor(chan)->write_filename,NULL,NULL) > 0) {<br>+ ast_str_set(&tmp, 0, "%s-out", ast_channel_monitor(chan)->filename_base);<br>+ if (ast_fileexists(ast_str_buffer(tmp), NULL, NULL) > 0) {<br>+ ast_filedelete(ast_str_buffer(tmp), NULL);<br> }<br>- ast_filerename(ast_channel_monitor(chan)->write_filename, filename, ast_channel_monitor(chan)->format);<br>+ ast_filerename(ast_channel_monitor(chan)->write_filename, ast_str_buffer(tmp), ast_channel_monitor(chan)->format);<br> } else {<br> ast_log(LOG_WARNING, "File %s not found\n", ast_channel_monitor(chan)->write_filename);<br> }<br> }<br> <br>- if (ast_channel_monitor(chan)->joinfiles && !ast_strlen_zero(ast_channel_monitor(chan)->filename_base)) {<br>- char tmp[1024];<br>- char tmp2[1024];<br>+ if (tmp && ast_channel_monitor(chan)->joinfiles && !ast_strlen_zero(ast_channel_monitor(chan)->filename_base)) {<br> const char *format = !strcasecmp(ast_channel_monitor(chan)->format,"wav49") ? "WAV" : ast_channel_monitor(chan)->format;<br> char *fname_base = ast_channel_monitor(chan)->filename_base;<br> const char *execute, *execute_args;<br>@@ -511,16 +509,17 @@<br> if (ast_strlen_zero(execute_args)) {<br> execute_args = "";<br> }<br>- <br>- snprintf(tmp, sizeof(tmp), "%s \"%s-in.%s\" \"%s-out.%s\" \"%s.%s\" %s &",<br>+<br>+ ast_str_set(&tmp, 0, delfiles ? "( " : "");<br>+ ast_str_append(&tmp, 0, "%s \"%s-in.%s\" \"%s-out.%s\" \"%s.%s\" %s &",<br> execute, fname_base, format, fname_base, format, fname_base, format,execute_args);<br> if (delfiles) {<br>- snprintf(tmp2,sizeof(tmp2), "( %s& rm -f \"%s-\"* ) &",tmp, fname_base); /* remove legs when done mixing */<br>- ast_copy_string(tmp, tmp2, sizeof(tmp));<br>+ /* remove legs when done mixing */<br>+ ast_str_append(&tmp, 0, "& rm -f \"%s-\"* ) &", fname_base);<br> }<br>- ast_debug(1,"monitor executing %s\n",tmp);<br>- if (ast_safe_system(tmp) == -1)<br>- ast_log(LOG_WARNING, "Execute of %s failed.\n",tmp);<br>+ ast_debug(1,"monitor executing %s\n", ast_str_buffer(tmp));<br>+ if (ast_safe_system(ast_str_buffer(tmp)) == -1)<br>+ ast_log(LOG_WARNING, "Execute of %s failed.\n", ast_str_buffer(tmp));<br> }<br> <br> if (!ast_strlen_zero(ast_channel_monitor(chan)->beep_id)) {<br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/6116">change 6116</a>. To unsubscribe, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/6116"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: I65f280e7d3cfad279d16f41823a4d6fddcbc4c88 </div>
<div style="display:none"> Gerrit-Change-Number: 6116 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Corey Farrell <git@cfware.com> </div>