[PATCH 2/2] Fix "flush_all 0" bug.

Tomash Brechko tomash.brechko at gmail.com
Thu Dec 6 12:43:30 UTC 2007


---
 trunk/server/memcached.c |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/trunk/server/memcached.c b/trunk/server/memcached.c
index f24fb9d..9f0f4e6 100644
--- a/trunk/server/memcached.c
+++ b/trunk/server/memcached.c
@@ -1745,7 +1745,16 @@ static void process_command(conn *c, char *command) {
             return;
         }
 
-        settings.oldest_live = realtime(exptime) - 1;
+        /*
+          If exptime is zero realtime() would return zero too, and
+          realtime(exptime) - 1 would overflow to the max unsigned
+          value.  So we process exptime == 0 the same way we do when
+          no delay is given at all.
+        */
+        if (exptime > 0)
+            settings.oldest_live = realtime(exptime) - 1;
+        else /* exptime == 0 */
+            settings.oldest_live = current_time - 1;
         item_flush_expired();
         out_string(c, "OK");
         return;
-- 
1.5.3.6.961.gecf4


More information about the memcached mailing list