]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Rollback rev 9253 from 3.1
authorAmos Jeffries <squid3@treenet.co.nz>
Mon, 1 Dec 2008 11:32:52 +0000 (00:32 +1300)
committerAmos Jeffries <squid3@treenet.co.nz>
Mon, 1 Dec 2008 11:32:52 +0000 (00:32 +1300)
This change to StoreIO overlooked the signedness of the StoreIO* length
parameter. It may have resulted in objects that should not have been
store making their way into the cache.

Caches created by 3.1.0.2 and earlier releases are known to contain many
invalid entries. Whether or not these entries are fatal to Squid is still
unknown. It is currently expected that they will be erased properly, but
cause a lot of cache.log warnings while that is happening.
It may be worth purging caches on upgrade out of these versions.

src/StoreIOBuffer.h
src/store_client.cc

index 4ef3c659231251c2160c208a6eadcd00c3e6225e..a9fd8a4f6ca3faa55cc7046309ff9447284059ef 100644 (file)
@@ -46,15 +46,9 @@ public:
     StoreIOBuffer():length(0), offset (0), data (NULL) {flags.error = 0;}
 
     StoreIOBuffer(size_t aLength, int64_t anOffset, char *someData) :
-            offset (anOffset), data (someData) {
-        /* maintain own state: detect size errors now */
-        if (aLength <0) {
-            flags.error = 1;
-            length = 0;
-        } else {
-            flags.error = 0;
-            length = aLength;
-        }
+            length (aLength), offset (anOffset), data (someData)
+    {
+        flags.error = 0;
     }
 
     /* Create a StoreIOBuffer from a MemBuf and offset */
index 0757cfa35d712767bb2ffdf7c410c3f845374d08..137839c865bb47dad4811c658423769593851513 100644 (file)
@@ -145,8 +145,11 @@ store_client::callback(ssize_t sz, bool error)
 {
     StoreIOBuffer result(sz, 0 ,copyInto.data);
 
-    if (error) {
+    if (sz < 0) {
         result.flags.error = 1;
+        result.length = 0;
+    } else {
+        result.flags.error = error ? 1 : 0;
     }
 
     result.offset = cmp_offset;