From c81bf01fc977fd1a12b521cf29abb5b466f1fda2 Mon Sep 17 00:00:00 2001 From: Moises Silva Date: Mon, 14 Feb 2011 14:44:38 -0500 Subject: [PATCH] freetdm: ftmod_r2 - set MF dump directory default to logdir --- libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c index d86fb43195..83705d9af8 100644 --- a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c +++ b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c @@ -725,9 +725,10 @@ static void dump_mf(openr2_chan_t *r2chan) if (r2data->mf_dump_size) { char *logname = R2CALL(ftdmchan)->logname; - ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Dumping IO output in prefix %s\n", logname); - snprintf(dfile, sizeof(dfile), logname ? "%s.s%dc%d.input.alaw" : "%s/s%dc%d.input.alaw", - logname ? logname : r2data->logdir, ftdmchan->span_id, ftdmchan->chan_id); + ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Dumping IO output in prefix %s\n", !ftdm_strlen_zero(logname) + ? logname : r2data->logdir); + snprintf(dfile, sizeof(dfile), !ftdm_strlen_zero(logname) ? "%s.s%dc%d.input.alaw" : "%s/s%dc%d.input.alaw", + !ftdm_strlen_zero(logname) ? logname : r2data->logdir, ftdmchan->span_id, ftdmchan->chan_id); f = fopen(dfile, "wb"); if (f) { ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Dumping IO input in file %s\n", dfile); @@ -737,8 +738,8 @@ static void dump_mf(openr2_chan_t *r2chan) ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Could not dump IO input in file %s, error: %s", dfile, strerror(errno)); } - snprintf(dfile, sizeof(dfile), logname ? "%s.s%dc%d.output.alaw" : "%s/s%dc%d.output.alaw", - logname ? logname : r2data->logdir, ftdmchan->span_id, ftdmchan->chan_id); + snprintf(dfile, sizeof(dfile), !ftdm_strlen_zero(logname) ? "%s.s%dc%d.output.alaw" : "%s/s%dc%d.output.alaw", + !ftdm_strlen_zero(logname) ? logname : r2data->logdir, ftdmchan->span_id, ftdmchan->chan_id); f = fopen(dfile, "wb"); if (f) { ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Dumping IO output in file %s\n", dfile);