From 2b904c0b9ee9e58ae5e3abd436f76d5ed7e61666 Mon Sep 17 00:00:00 2001 From: Moises Silva Date: Fri, 30 Dec 2011 18:28:27 -0500 Subject: [PATCH] freetdm: ftmod_wanpipe - Do not set the output read length unless the read operation is successful --- libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c b/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c index d0d66205a5..f63a275194 100644 --- a/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c +++ b/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c @@ -1016,7 +1016,7 @@ static FIO_READ_FUNCTION(wanpipe_read) memset(&hdrframe, 0, sizeof(hdrframe)); rx_len = sangoma_readmsg_tdm(ftdmchan->sockfd, &hdrframe, (int)sizeof(hdrframe), data, (int)*datalen, 0); - *datalen = rx_len; + *datalen = 0; if (rx_len == 0) { ftdm_log_chan_msg(ftdmchan, FTDM_LOG_WARNING, "Read 0 bytes\n"); @@ -1033,6 +1033,7 @@ static FIO_READ_FUNCTION(wanpipe_read) #endif return FTDM_FAIL; } + *datalen = rx_len; if (ftdm_channel_test_feature(ftdmchan, FTDM_CHANNEL_FEATURE_IO_STATS)) { wanpipe_read_stats(ftdmchan, &hdrframe);