Project "FreeSWITCH Source" received a push.

branch: master updated

       via: 1842798e95eeeed61604455ebcd5001bdf35eeb1 (commit)
      from: 155571d841effd7411686952da0d679af34bc0ac (commit)


= COMMIT LOG ===========================================================
committer: Moises Silva
comments: 
freetdm: ftmod_r2 - check for io dump file errors on open

diff --git a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c
index 0217a51..d86fb43 100644
--- a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c
+++ b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c
@@ -729,16 +729,24 @@ static void dump_mf(openr2_chan_t *r2chan)
 		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);
 		f = fopen(dfile, "wb");
-		ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Dumping IO input in file %s\n", dfile);
-		ftdm_channel_command(ftdmchan, FTDM_COMMAND_DUMP_INPUT, f);
-		fclose(f);
+		if (f) {
+			ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Dumping IO input in file %s\n", dfile);
+			ftdm_channel_command(ftdmchan, FTDM_COMMAND_DUMP_INPUT, f);
+			fclose(f);
+		} else {
+			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);
 		f = fopen(dfile, "wb");
-		ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Dumping IO output in file %s\n", dfile);
-		ftdm_channel_command(ftdmchan, FTDM_COMMAND_DUMP_OUTPUT, f);
-		fclose(f);
+		if (f) {
+			ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Dumping IO output in file %s\n", dfile);
+			ftdm_channel_command(ftdmchan, FTDM_COMMAND_DUMP_OUTPUT, f);
+			fclose(f);
+		} else {
+			ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Could not dump IO output in file %s, error: %s", dfile, strerror(errno));
+		}
 	}
 }
 
========================================================================

Summary of changes:
 libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c |   20 ++++++++++++++------
 1 files changed, 14 insertions(+), 6 deletions(-)

this email was generated because of /git/your-repo.git/hooks/post-receive by the file /git-core/contrib/hooks/post-receive-email
For more info, see http://blog.chomperstomp.com/?p=630 --
FreeSWITCH Source