aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2017-02-14 14:59:51 +0000
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2017-03-19 22:25:36 +0100
commitaf7c3750070dfad2ebd2d615f2c3fecda7e58053 (patch)
tree1c294cb6518056d01c7954d5cb1d0f8c22f35fc6
parent645b757df77b2f85028e16c2e303b288fe2474af (diff)
downloadnx-libs-af7c3750070dfad2ebd2d615f2c3fecda7e58053.tar.gz
nx-libs-af7c3750070dfad2ebd2d615f2c3fecda7e58053.tar.bz2
nx-libs-af7c3750070dfad2ebd2d615f2c3fecda7e58053.zip
Xserver/os/io.c: Bail out early from FlushClient if nothing needs to be written.
Found in X.org commit: commit d5bf6f95f31037bd49b11348b500c3c13b7e0c99 Author: Keith Packard <keithp@keithp.com> Date: Thu Oct 4 14:42:37 2012 -0700 Fix FlushClient to write extraBuf when provided (regression fix) In commit: commit 092c57ab173c8b71056f6feb3b9d04d063a46579 Author: Adam Jackson <ajax@redhat.com> Date: Fri Jun 17 14:03:01 2011 -0400 os: Hide the Connection{In,Out}put implementation details Reviewed-by: Daniel Stone <daniel@fooishbar.org> Signed-off-by: Adam Jackson <ajax@redhat.com> the check for an empty output buffer was moved from one calling location into the FlushClient implementation itself. However, this neglected the possibility that additional data, in the form of 'extraBuf' would be passed to FlushClient from other code paths. If the output buffer happened to be empty at that time, the extra data would never be written to the client. This is fixed by checking the total data to be written, which includes both pending and extra data, instead of just the pending data. Signed-off-by: Keith Packard <keithp@keithp.com> Reviewed-by: Julien Cristau <jcristau@debian.org> Backported-to-NX-by: Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
-rw-r--r--nx-X11/programs/Xserver/os/io.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/nx-X11/programs/Xserver/os/io.c b/nx-X11/programs/Xserver/os/io.c
index a02d7fb0c..23f436b84 100644
--- a/nx-X11/programs/Xserver/os/io.c
+++ b/nx-X11/programs/Xserver/os/io.c
@@ -1004,6 +1004,10 @@ FlushClient(ClientPtr who, OsCommPtr oc, const void *__extraBuf, int extraCount)
written = 0;
padsize = padlength[extraCount & 3];
notWritten = oco->count + extraCount + padsize;
+
+ if (!notWritten)
+ return 0;
+
todo = notWritten;
while (notWritten) {
long before = written; /* amount of whole thing written */