Can anyone please explain why the following patch shouldn't be applied?

diff --git a/src/backend/storage/ipc/shm_mq.c b/src/backend/storage/ipc/shm_mq.c
index 126cb07..4cd52ac 100644
--- a/src/backend/storage/ipc/shm_mq.c
+++ b/src/backend/storage/ipc/shm_mq.c
@@ -584,7 +584,7 @@ shm_mq_receive(shm_mq_handle *mqh, Size *nbytesp, void 
**datap, bool nowait)
                        if (mqh->mqh_partial_bytes + rb > sizeof(Size))
                                lengthbytes = sizeof(Size) - 
mqh->mqh_partial_bytes;
                        else
-                               lengthbytes = rb - mqh->mqh_partial_bytes;
+                               lengthbytes = rb;
                        memcpy(&mqh->mqh_buffer[mqh->mqh_partial_bytes], 
rawdata,
                                   lengthbytes);
                        mqh->mqh_partial_bytes += lengthbytes;


I'm failing to understand why anything should be subtracted. Note that the
previous iteration must have called shm_mq_inc_bytes_read(), so "rb" should
not include anything of mqh->mqh_partial_bytes. Thanks.

-- 
Antonin Houska
Cybertec Schönig & Schönig GmbH
Gröhrmühlgasse 26
A-2700 Wiener Neustadt
Web: http://www.postgresql-support.de, http://www.cybertec.at


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to