From a32d0a1a8f98d9ae3eaa1030be967f340bd90ca1 Mon Sep 17 00:00:00 2001 From: Tilghman Lesher Date: Wed, 4 Feb 2009 18:52:27 +0000 Subject: [PATCH] Merged revisions 173458 via svnmerge from https://origsvn.digium.com/svn/asterisk/trunk ........ r173458 | tilghman | 2009-02-04 12:48:06 -0600 (Wed, 04 Feb 2009) | 9 lines When using a socket as a FILE *, the stdio functions will sometimes try to do an fseek() on the stream, which is an invalid operation for a socket. Turning off buffering explicitly lets the stdio functions know they cannot do this, thus avoiding a potential error. (closes issue #14400) Reported by: fnordian Patches: tcptls.patch uploaded by fnordian (license 110) ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.6.1@173459 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- main/tcptls.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/main/tcptls.c b/main/tcptls.c index 0b58dc1f52..ebb088a91c 100644 --- a/main/tcptls.c +++ b/main/tcptls.c @@ -135,8 +135,10 @@ static void *handle_tls_connection(void *data) /* * open a FILE * as appropriate. */ - if (!tcptls_session->parent->tls_cfg) + if (!tcptls_session->parent->tls_cfg) { tcptls_session->f = fdopen(tcptls_session->fd, "w+"); + setvbuf(tcptls_session->f, NULL, _IONBF, 0); + } #ifdef DO_SSL else if ( (tcptls_session->ssl = SSL_new(tcptls_session->parent->tls_cfg->ssl_ctx)) ) { SSL_set_fd(tcptls_session->ssl, tcptls_session->fd);