[Bugfix] Properly report transport errors to GNUTLS.
Signed-off-by: Martin Koegler <mkoegler@auto.tuwien.ac.at>
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@4125 3789f03b-4d11-0410-bbf8-ca57d06f2519
diff --git a/common/rdr/TLSOutStream.cxx b/common/rdr/TLSOutStream.cxx
index 59edf15..888b455 100644
--- a/common/rdr/TLSOutStream.cxx
+++ b/common/rdr/TLSOutStream.cxx
@@ -25,6 +25,7 @@
#include <rdr/Exception.h>
#include <rdr/TLSException.h>
#include <rdr/TLSOutStream.h>
+#include <errno.h>
#ifdef HAVE_GNUTLS
using namespace rdr;
@@ -35,8 +36,15 @@
size_t size)
{
OutStream* out = (OutStream*) str;
- out->writeBytes(data, size);
- out->flush();
+
+ try {
+ out->writeBytes(data, size);
+ out->flush();
+ } catch (Exception& e) {
+ gnutls_transport_set_global_errno(EINVAL);
+ return -1;
+ }
+
return size;
}