]> git.pond.sub.org Git - empserver/blobdiff - src/lib/common/ef_verify.c
Verify table uid sanity more tightly
[empserver] / src / lib / common / ef_verify.c
index fb18e663479669865d61e4baf1f234598534a94d..1ddd89e097daa11eb1b0bed80a7f8d4a713b44ac 100644 (file)
@@ -28,7 +28,7 @@
  *
  *  Known contributors to this file:
  *     Ron Koenderink, 2005
- *     Markus Armbruster, 2006-2010
+ *     Markus Armbruster, 2006-2011
  */
 
 #include <config.h>
 #include <stdarg.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include "empobj.h"
 #include "file.h"
 #include "misc.h"
 #include "nsc.h"
-#include "plane.h"
 #include "product.h"
 
 static void verify_fail(int, int, struct castr *, int, char *, ...)
@@ -130,7 +130,7 @@ static int
 verify_row(int type, int row)
 {
     struct castr *ca = ef_cadef(type);
-    struct emptypedstr *row_ref;
+    struct empobj *row_ref;
     int i, j, n;
     struct valstr val;
     int ret_val = 0;
@@ -150,6 +150,9 @@ verify_row(int type, int row)
        }
     }
 
+    if (!empobj_in_use(type, row_ref))
+       return ret_val;
+
     for (i = 0; ca[i].ca_name; ++i) {
        if (ca[i].ca_get)
            continue;           /* virtual */
@@ -166,10 +169,6 @@ verify_row(int type, int row)
            }
            if (ca[i].ca_table == type && i == 0) {
                /* uid */
-               /* Some files contain zeroed records, cope */
-               /* TODO tighten this check */
-               if (val.val_as.lng == 0)
-                   continue;
                if (val.val_as.lng != row) {
                    verify_fail(type, row, &ca[i], j,
                                "value is %ld instead of %d",