UT: fix comparison for expired timestamps.
authorWilfried Goesgens <dothebart@citadel.org>
Wed, 5 Jun 2013 07:46:20 +0000 (09:46 +0200)
committerWilfried Goesgens <dothebart@citadel.org>
Wed, 5 Jun 2013 07:46:20 +0000 (09:46 +0200)
citadel/database.c

index 3bab5776d90ebe522eefb34b1c751f631de98ca1..398f1eb0f864b5b420f48fb401d4f4abb4c4bf3a 100644 (file)
@@ -923,24 +923,25 @@ time_t CheckIfAlreadySeen(const char *Facility,
                          long ccid,
                          long ioid)
 {
+       time_t InDBTimeStamp = 0;
        struct UseTable ut;
        struct cdbdata *cdbut;
 
        if (cType != eWrite)
        {
-               time_t InDBTimeStamp = 0;
                SEENM_syslog(LOG_DEBUG, "Loading");
                cdbut = cdb_fetch(CDB_USETABLE, SKEY(guid));
                if (cdbut != NULL) {
                        memcpy(&ut, cdbut->ptr,
                               ((cdbut->len > sizeof(struct UseTable)) ?
                                sizeof(struct UseTable) : cdbut->len));
-                       
-                       if (ut.ut_timestamp > antiexpire)
+                       InDBTimeStamp = ut.ut_timestamp;
+
+                       if (InDBTimeStamp < antiexpire)
                        {
                                SEENM_syslog(LOG_DEBUG, "Found - Not expired.");
                                cdb_free(cdbut);
-                               return ut.ut_timestamp;
+                               return InDBTimeStamp;
                        }
                        else
                        {
@@ -968,7 +969,7 @@ time_t CheckIfAlreadySeen(const char *Facility,
                  &ut, sizeof(struct UseTable) );
 
        SEENM_syslog(LOG_DEBUG, "Done Saving");
-       return 0;
+       return InDBTimeStamp;
 }