]> git.pond.sub.org Git - empserver/commitdiff
Catch selectors that make xundump oops early
authorMarkus Armbruster <armbru@pond.sub.org>
Mon, 12 May 2008 10:39:38 +0000 (12:39 +0200)
committerMarkus Armbruster <armbru@pond.sub.org>
Mon, 12 May 2008 10:39:38 +0000 (12:39 +0200)
Oops in new verify_ca(), which runs during initialization.

src/lib/common/ef_verify.c

index 62c5cab27d95e4f095cac11e5882ce7d7eef3505..dc3c2e4c86d0286727a3aa4d3fd39ab917b377cd 100644 (file)
@@ -70,6 +70,25 @@ verify_fail(int type, int row, struct castr *ca, int idx, char *fmt, ...)
     putc('\n', stderr);
 }
 
+static int
+verify_ca(int type)
+{
+    struct castr *ca = ef_cadef(type);
+    int i;
+
+    for (i = 0; ca[i].ca_name; i++) {
+       /*
+        * Virtual selectors must be NSC_EXTRA, because xundump can't
+        * cope with them without setter methods.  Exception: if
+        * EFF_MEM is not set, xundump doesn't touch the table.
+        */
+       if (CANT_HAPPEN((ef_flags(type) & EFF_MEM)
+                       && ca[i].ca_get && !(ca[i].ca_flags & NSC_EXTRA)))
+           ca[i].ca_flags |= NSC_EXTRA;
+    }
+    return 0;
+}
+
 static int
 verify_row(int type, int row)
 {
@@ -199,6 +218,7 @@ ef_verify()
     for (ep = empfile; ep->name; ep++) {
        if (!ef_cadef(ep->uid))
            continue;
+       verify_ca(ep->uid);
        for (i = 0; i < ef_nelem(ep->uid); i++) {
            retval += verify_row(ep->uid, i);
        }