]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Fixed Ipc::Mem::Segment::reserve().
authorAlex Rousskov <rousskov@measurement-factory.com>
Tue, 12 Apr 2011 18:47:31 +0000 (12:47 -0600)
committerAlex Rousskov <rousskov@measurement-factory.com>
Tue, 12 Apr 2011 18:47:31 +0000 (12:47 -0600)
It was returning the pointer to the end of the reserved area.

Added debugging.

src/ipc/mem/Segment.cc

index 3de370bf71121bf9494ca8c0f335e7b3693d4ef5..1bd100a52540005c19fd3f528921f0dfc3a0fb51 100644 (file)
@@ -51,6 +51,8 @@ Ipc::Mem::Segment::create(const int aSize)
     theSize = aSize;
     theReserved = 0;
 
+    debugs(54, 3, HERE << "created " << theName << " segment: " << theSize);
+
     attach();
 }
 
@@ -80,6 +82,8 @@ Ipc::Mem::Segment::open()
         theSize = s.st_size;
     }
 
+    debugs(54, 3, HERE << "opened " << theName << " segment: " << theSize);
+
     attach();
 }
 
@@ -118,8 +122,9 @@ Ipc::Mem::Segment::reserve(size_t chunkSize)
 {
     assert(chunkSize <= theSize);
     assert(theReserved <= theSize - chunkSize);
+    void *result = reinterpret_cast<char*>(mem()) + theReserved;
     theReserved += chunkSize;
-    return reinterpret_cast<char*>(mem()) + theReserved;
+    return result;
 }
 
 /// Generate name for shared memory segment. Replaces all slashes with dots.