[PATCH 17/19 v2] Set padding bytes to 0 in WriteToClient
Alan Coopersmith
alan.coopersmith at oracle.com
Mon Jul 2 19:36:51 PDT 2012
Clear them out when needed instead of leaving whatever values were
present in previously sent messages.
Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
---
v2: Simplified as suggested by Keith to just use memset instead of a
Duff-device style switch statement, since most calls won't need this.
os/io.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/os/io.c b/os/io.c
index b67a5f3..8d0e5cc 100644
--- a/os/io.c
+++ b/os/io.c
@@ -815,7 +815,11 @@ WriteToClient(ClientPtr who, int count, const void *__buf)
NewOutputPending = TRUE;
FD_SET(oc->fd, &OutputPending);
memmove((char *) oco->buf + oco->count, buf, count);
- oco->count += count + padBytes;
+ oco->count += count;
+ if (padBytes) {
+ memset(oco->buf + oco->count, '\0', padBytes);
+ oco->count += padBytes;
+ }
return count;
}
--
1.7.9.2
More information about the xorg-devel
mailing list