2014-05-20 16:05:40 +02:00
Author: Michal Srb <msrb@suse.com>
Subject: Ignore EPIPE on write.
Patch-Mainline: To be upstreamed
References: bnc#864676
If the VNC server closes connection after our last read and before this write, we will report error message about EPIPE.
This situation is no error, however, we should quit normally same as when we find out that connection was closed during read.
2024-02-20 17:03:58 +01:00
Index: tigervnc-1.13.1/common/rdr/FdOutStream.cxx
2014-05-20 16:05:40 +02:00
===================================================================
2024-02-20 17:03:58 +01:00
--- tigervnc-1.13.1.orig/common/rdr/FdOutStream.cxx
+++ tigervnc-1.13.1/common/rdr/FdOutStream.cxx
2022-02-17 11:42:51 +01:00
@@ -128,8 +128,12 @@ size_t FdOutStream::writeFd(const void*
2018-08-02 11:24:03 +02:00
#endif
2016-09-13 16:12:30 +02:00
} while (n < 0 && (errno == EINTR));
2014-05-20 16:05:40 +02:00
2016-09-13 16:12:30 +02:00
- if (n < 0)
- throw SystemException("write", errno);
2014-05-20 16:05:40 +02:00
+ if (n < 0) {
+ if(errno == EPIPE)
+ n = length; // Ignore EPIPE and fake successfull write, it doesn't matter that we are writing to closed socket, we will find out once we try to read from it.
+ else
+ throw SystemException("write", errno);
+ }
gettimeofday(&lastWrite, NULL);