Merge branch 'tom_dev'
[exim.git] / src / src / exim_dbutil.c
index 5e00eaea86f3c4544a3099448677f5bb773b8837..1e94f33e60610eb79ff016bc3d031aac23b8372b 100644 (file)
@@ -1,10 +1,10 @@
-/* $Cambridge: exim/src/src/exim_dbutil.c,v 1.6 2005/06/22 15:44:38 ph10 Exp $ */
+/* $Cambridge: exim/src/src/exim_dbutil.c,v 1.12 2009/11/16 19:50:36 nm4 Exp $ */
 
 /*************************************************
 *     Exim - an Internet mail transport agent    *
 *************************************************/
 
-/* Copyright (c) University of Cambridge 1995 - 2005 */
+/* Copyright (c) University of Cambridge 1995 - 2009 */
 /* See the file NOTICE for conditions of use and distribution. */
 
 
@@ -316,7 +316,7 @@ if (rc < 0)
   printf("** Failed to get %s lock for %s: %s",
     ((flags & O_RDONLY) != 0)? "read" : "write", buffer,
     (errno == ETIMEDOUT)? "timed out" : strerror(errno));
-  close(dbblock->lockfd);
+  (void)close(dbblock->lockfd);
   return NULL;
   }
 
@@ -336,7 +336,7 @@ if (dbblock->dbptr == NULL)
     ""
     #endif
     );
-  close(dbblock->lockfd);
+  (void)close(dbblock->lockfd);
   return NULL;
   }
 
@@ -361,7 +361,7 @@ static void
 dbfn_close(open_db *dbblock)
 {
 EXIM_DBCLOSE(dbblock->dbptr);
-close(dbblock->lockfd);
+(void)close(dbblock->lockfd);
 }
 
 
@@ -767,8 +767,8 @@ for(;;)
   /* If the buffer contains just one digit, or just consists of "d", use the
   previous name for an update. */
 
-  if ((isdigit((uschar)buffer[0]) && !isdigit((uschar)buffer[1])) ||
-       Ustrcmp(buffer, "d") == 0)
+  if ((isdigit((uschar)buffer[0]) && (buffer[1] == ' ' || buffer[1] == '\0'))
+       || Ustrcmp(buffer, "d") == 0)
     {
     if (name[0] == 0)
       {
@@ -894,7 +894,8 @@ for(;;)
             break;
 
             case type_ratelimit:
-            ratelimit = (dbdata_ratelimit *)value;
+            ratelimit = (dbdata_ratelimit *)record;
+            length = sizeof(dbdata_ratelimit);
             switch(fieldno)
               {
               case 0:
@@ -904,6 +905,7 @@ for(;;)
 
               case 1:
               ratelimit->time_usec = Uatoi(value);
+              break;
 
               case 2:
               ratelimit->rate = Ustrtod(value, NULL);
@@ -1014,7 +1016,7 @@ for(;;)
       break;
 
       case type_ratelimit:
-      ratelimit = (dbdata_ratelimit *)value;
+      ratelimit = (dbdata_ratelimit *)record;
       printf("0 time stamp:  %s\n", print_time(ratelimit->time_stamp));
       printf("1 fract. time: .%06d\n", ratelimit->time_usec);
       printf("2 sender rate: % .3f\n", ratelimit->rate);