]> code.citadel.org Git - citadel.git/commitdiff
Abort if source database is not 32-bit.
authorArt Cancro <ajc@citadel.org>
Fri, 7 Apr 2023 17:29:34 +0000 (13:29 -0400)
committerArt Cancro <ajc@citadel.org>
Fri, 7 Apr 2023 17:29:34 +0000 (13:29 -0400)
We detect this in the very first table (msgmain) by bailing out if
we see any key with a length other than 4 bytes.

citadel/utils/ctdl3264.c

index 99404a3f42651afd82675044ad02e11c86433287..9306a03c26a1ee74e61e3059165f174019190c34 100644 (file)
@@ -114,6 +114,13 @@ void convert_msgmain(int which_cdb, DBT *key, DBT *data) {
        memcpy(&msgnum, key->data, sizeof(msgnum));
        printf("msgmain: len is %d , key is %ld\n", key->size, msgnum);
 
+       if (key->size != 4) {
+               printf("\033[31m\033[1m *** SOURCE DATABASE IS NOT 32-BIT *** ABORTING *** \033[0m\n");
+               abort();
+       }
+
+
+
        // If the msgnum is positive, we are looking at a MESSAGE
        // If the msgnum is negative, we are looking at METADATA
 }
@@ -150,7 +157,7 @@ void convert_table(int which_cdb) {
        int ret;
        char dbfilename[32];
 
-       printf("Converting table %d\n", which_cdb);
+       printf("\033[32m\033[1mConverting table %d\033[0m\n", which_cdb);
 
        // shamelessly swiped from https://docs.oracle.com/database/bdb181/html/programmer_reference/am_cursor.html
        DB *dbp;